import { z } from"zod";// primitive valuesz.string();z.number();z.bigint();z.boolean();z.date();z.symbol();// empty typesz.undefined();z.null();z.void(); // accepts undefined// catch-all types, allows any valuez.any();z.unknown();z.never(); // allows no valuesz.enum([`development`,`test`,`production`]).default(`development`),
String Validation
// validationsz.string().max(5);z.string().min(5);z.string().length(5);z.string().email();z.string().url();z.string().emoji();z.string().uuid();z.string().nanoid();z.string().cuid();z.string().cuid2();z.string().ulid();z.string().regex(regex);z.string().includes(string);z.string().startsWith(string);z.string().endsWith(string);z.string().datetime(); // ISO 8601; by default only `Z` timezone allowedz.string().ip(); // defaults to allow both IPv4 and IPv6// transformsz.string().trim(); // trim whitespacez.string().toLowerCase(); // toLowerCasez.string().toUpperCase(); // toUpperCase// added in Zod 3.23z.string().date(); // ISO date format (YYYY-MM-DD)z.string().time(); // ISO time format (HH:mm:ss[.SSSSSS])z.string().duration(); // ISO 8601 durationz.string().base64();