Course lesson
Perform Runtime Type-checks on Primitives and Objects with zod
zod is a powerful library allowing to run runtime type-checks.
- Duration
- 9 min
- 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.