Zod is great, but it’s for *runtime* validation
Zod is great, but it’s for *runtime* validation.
I've seen some teams using Zod's infer for nearly all their types. This just adds overhead and abstraction.
Rule: If z.parse/safeParse isn’t called, just use a plain TypeScript type/interface. A Zod schema is needless if the schema is *only* used to derive a TypeScript type via z.infer.
Use Zod to validate at runtime:
✅ cookies
✅ form inputs
✅ URL params
✅ localStorage
✅ JSON responses
✅ Environment variables
Use plain TS types/interfaces for everything else.