Colin McDonnell
Colin McDonnell
This will be changed in Zod 4 — refinements will be stored in the schema itself instead of in an enclosing `ZodEffects`.
Thanks, this is excellent stuff! Apologies for the long turnaround time. I'm hesitant to merge features like this into Zod 3 for bundle size reasons. Zod 4 will have better...
`.passthrough()` is intended to only work shallowly. For Zod 4 I'm exploring a way to set the object strictness setting globally.
I think it's an interesting idea. If if can be done in a performant way I'll try to incorporate something like this into Zod 4.
The parsing logic is going to be entirely rewritten in Zod 4 so I'm afraid merging this particular implementation doesn't make much sense. But I am still planning to investigate...
You need to enable `strictNullChecks: true` or `strict: true`. Once enabled you will not see this error. This is a requirement for Zod to properly type the results of parsing.
This feels very specific to me, and doesn't strike me as general-purpose API that would be widely used. Solving this with `.preprocess` is exactly what I'd recommend here.
Thanks for this PR. The error map system is being totally rewritten for Zod 4 so I'm afraid there's little point in modifying this API now. I'll keep this use...
This has landed in Zod 3.23. https://github.com/colinhacks/zod/releases/tag/v3.23.0
Unfortunately `.catchall()` is a bit of a footgun in this way. Zod treats it like a "fallback" for unrecognized keys but TypeScript requires all explicitly defined keys to conform.