Colin McDonnell

Results 258 comments of Colin McDonnell

Thank you! Fascinating that this works...

This has landed in Zod 3.23. https://github.com/colinhacks/zod/releases/tag/v3.23.0

With https://github.com/colinhacks/zod/pull/3295 merged this is now possible in `zod@beta` (without the addition of a new method) ```ts const schema = z.object({ name: z.string() }); const getName = (data: unknown) =>...

It's true that the "ask" here is not well-defined. It's not clear when Zod should continue execution vs. deeming the input "un-preprocessable". What should be returned if you pass in...

I understand your frustration here and I've encountered some similar infinite loop problems before. That's a lot of generated code and there are a lot of recursive types there. Seems...

This has landed in Zod 3.23. https://github.com/colinhacks/zod/releases/tag/v3.23.0

My preferred solution here is the one that landed in #3169, which will land in Zod 3.23 shortly. This is all liable to change in Zod 4 as well.

Thanks for the PR! I ended up merging https://github.com/colinhacks/zod/pull/2666 instead which has similar functionality.

This is intended, see #2157 for the justification. You can use `.superRefine()` for custom behavior here. ```ts const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+-\.]*)[A-Z0-9_'+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; const emailSchema = z.string().superRefine((data, ctx) => { if (!emailRegex.test(data))...