Colin McDonnell
Colin McDonnell
Great idea and great PR. Ultimately this was implemented in #1537 as `.catch` and just landed in Zod 3.20. Thanks for the amazing work here and apologies for the delay...
A modified version of this PR was merged in 3.22. Thanks @santosmarco-caribou!
This isn't going to happen in Zod, sorry folks. I find the `.when` API very unaesthetic and it adds nothing in terms of type safety. There's no other scenario where...
Thanks for the response @deniskabana. The problem is that these refinements shouldn't live inside the `ZodDate` instance. They should get attached to the `ZodObject` schema that contains `startDate` and `endDate`....
Zod 3.20 just landed, sorry for the confusion! `npm install zod@latest`
Probably best achieved with `.regex()`
I appreciate the work done for this PR by Arturo and all the good discussions. Apologies for the delay on replying. If you've read my opinion of `ZodDiscriminatedUnion` on other...
> Do you have plans on adding the z.switch() functionality @maxArturo Switch would land in Zod 4, if at all. I'm doing a long-overdue house cleaning right now before starting...
Too much of a footgun. Many many people will inevitably try this: ```ts const keys = ['a', 'b']; const schema = z.object({ a: z.string(), b: z.string(), c: z.string() }).pick(keys); //...