TypeScript-first schema validation with static type inference
Introducció
Zod is a TypeScript-first validation library.
Using Zod, you can define schemas you can use to validate data, from a simple string to a complex nested object.
import { z } from "zod/v4";
const User = z.object({
name: z.string(),
});
// some untrusted data...
const input = { /* stuff */ };
// the parsed result is validated and type safe!
const data = User.parse(input);
// so you can use it with confidence :)
console.log(data.name);