Zod
TypeScript-first schema validation.
What is Zod
Zod defines a schema once and gives you both runtime validation and a static TypeScript type.
Install
npm install zodUsage
import { z } from 'zod';
const User = z.object({ name: z.string(), age: z.number().min(0) });
type User = z.infer<typeof User>;
const u = User.parse(data);Docs
Official documentation: Zod.