Whimsy - is there any function or way to make s...
is there any function or way to make schema fully optional, like literally every property, every nested lazy model?
this does work, but is it like correct, is there anything seriously wrong with it or
10 Replies
I think this is roughly the right approach (missing
ZodDiscriminatedUnion
, maybe others?)and zodeffects class for .refine stuff
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I don't think
deepPartial
works on lazy schemasUnknown User•2mo ago
Message Not Public
Sign In & Join Server To View
No prob! Here's the docs: https://zod.dev/?id=recursive-types
GitHub
TypeScript-first schema validation with static type inference
TypeScript-first schema validation with static type inference
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Yeah, that's right.
You can use it for anything you want (similar to
z.custom
which is undocumented), but the only good use case is recursive types.Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
ahh, nice, that's newish, I think? Or maybe I couldn't find it last time I looked 😂