configure({ onUndeclaredKey: 'delete' }) seems to allow extra properties through.
Or have I done something wrong
Yields:
I'm on 2.0.4
10 Replies
The config should be defined in a separate file, see:
https://arktype.io/docs/configuration#onundeclaredkey
This could have worked in the past though so if that's the case I apologize, it really should never have worked as for other settings fundamentally we have to know the global config ahead of time
Ohh okay. Gotcha. That makes sense anyway in a real app. But doesn’t play well with just playing around.
And maybe the docs should call that out, as it’s two files in the example but not clear why
For most config options you can configure them at a scope level inline, and obviously for
onUndeclaredKey
you can also use the per-object config.
It's just for stuff like onUndeclaredKey
that actually changes the properties of the type itself, it gets very messy with caching if you allow it to be configured per scope like thatIt actually kinda does, just not for each individual item- maybe it should? Feels repetitive but maybe worth

I'll add the config comment to the other examples
Yeah. Guess I should read the whole thing lol. I was looking here.

Sorry posted and ran to lunch so on my phone.
You shouldn't have to read all the docs to have context on how to use a particular feature, I'll add it in the other areas as well
Thank you for all you do. I’m going to try to replace zod for Arktype at work this year. Wish me luck.
Now is the time with docs and 2.0 out! Good luck 🙂