flâneur

Zod | Documentation

zod.dev · 339 words · saved by 2 readers

Introduction to Zod - TypeScript-first schema validation library with static type inference

Introduction 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 * as z from "zod"; 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); Features Zero external dependencies Works in Node.js and all modern browsers Tiny: 2kb core bundle (gzipped) Immutable API: methods return a…

saved by

related reading