Zod 4 Rewrites TypeScript Schema Validator With Faster Parsing and New APIs
Zod 4, a ground-up rewrite of the TypeScript-first schema validation library, was released as a stable major version in 2025 and requires TypeScript 5.5 or newer. The release delivers significant performance improvements, including reduced TypeScript compiler instantiations and faster runtime parsing, which benefits large codebases. Key API changes include string formats moving to standalone top-level functions like z.email() and z.url() for better tree-shaking, and four separate error options consolidating into a single error parameter. Error formatting has also shifted to three standalone helpers — z.flattenError, z.treeifyError, and z.prettifyError — while object strictness methods were renamed to z.strictObject() and z.looseObject(). Deprecated Zod 3 APIs continue to function with warnings, allowing developers to migrate their schemas incrementally rather than all at once.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in