Welcome to Zod discussions! #263
Replies: 3 comments 1 reply
-
Hello, I'm trying Zod out and really enjoying it so far. The README docs for
What does "with full type information" mean here? I couldn't find examples in the README of anything being returned from |
Beta Was this translation helpful? Give feedback.
-
It just means the returned value is statically typed. So you can, for instance, hover over it and see it's type. You'll also get autocompletion, etc if you're using an IDE that supports it. So Zod is great for parsing, say, payloads to an API endpoint in order to guarantee certain properties are present: const schema = z.object({ name: z.string() }); const rawPayload: any = { /* some blob of json */ }; parsedPayload.name; // => string |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for making Zod! Both joi and yup has an option "abortEarly", which instructs the validator to stop validation upon encountering the first issue. Is there a similar option in Zod? Maybe the "check" method do exactly this? If this is true, it worth mentioning this in README. Thanks! Bing |
Beta Was this translation helpful? Give feedback.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
Beta Was this translation helpful? Give feedback.
All reactions