Zod
Introducció
Section titled “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);
El contingut d'aquest lloc web té llicència CC BY-NC-ND 4.0.
©2022-2025 xtec.dev