Zod 4

Schema validation.

Visit website ↗

Console’s review

· Reviewed by David Mytton

What we like

The new major version includes large performance improvements. New “Zod mini” specifically designed to be lightweight and more tree-shakable. Now supports file schemas, recursive objects, template literals, falsy and truthy strings. Migration from v3 uses subpaths within the same package version - a clever way to manage breaking changes.

Tradeoffs

Breaking changes in a major library are always disruptive, but lots of effort has gone into allowing support for v3 and v4 simultaneously.

Console is a free weekly newsletter with short reviews of developer tools, covering strengths and tradeoffs. This review reflects our assessment at publication. Read our selection criteria and learn about Console.

Earlier review

· Reviewed by David Mytton

What we like

Lightweight zero-dependency type validation for TypeScript (or JS) in Node or the browser. Gives you the power of types at runtime, not just when writing code e.g. checking responses from APIs or from user inputs. Supports complex types including datetimes, IP addresses, objects, functions, etc. Large ecosystem of uses e.g. JSON to Zod, Zod to OpenAPI.

Tradeoffs

The docs assume you know why you would want to use this, which isn’t completely clear until you experience the benefits.

Console is a free weekly newsletter with short reviews of developer tools, covering strengths and tradeoffs. This review reflects our assessment at publication. Read our selection criteria and learn about Console.

Discover your next favorite tool

Independent devtool reviews and the latest betas, in your inbox every Thursday. Free.