Dev.to
7/22/2026

The original title is: "What Changed in Zod 4, and How I Migrated Production Schemas"
Original: What Changed in Zod 4, and How I Migrated Production Schemas
Short summary
Zod 4 is a ground-up rewrite of the TypeScript-first schema validator with four breaking API changes: string formats are now top-level functions (z.email()), error options collapsed into one error parameter, error formatting moved to standalone helpers, and .strict()/.passthrough() became z.strictObject()/z.looseObject(). Deprecated Zod 3 APIs still work with warnings, enabling incremental migration. The author maps each change with before/after code examples.
- •String formats promoted to tree-shakeable top-level functions like z.email() and z.uuid()
- •Four error options replaced by a single error parameter accepting string or function
- •Error formatting moved to z.flattenError, z.treeifyError, and z.prettifyError helpers
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



