Lesson
Perform Runtime Type-checks on Primitives and Objects with zod
Create zod schemas to validate primitive type and object type values in runtime. Analyze the errors to see how a value doesn't correspond to schema expectations
- Access
- Included
- Transcript
- Needs source
zod is a powerful library allowing to run runtime type-checks.
It's complementary to TypeScript, which does type checks in compile time.
In this lesson we create few schemas that represent primitive type values, along with zod utilities which make these more precise. We also create object schemas and nest one inside another.
All schemas are being validated against example values. We analyze how to interpret error messages in case of failures.