Primitive Types in Zod
From the Zod cheat sheet ยท Primitive Schemas ยท verified Jul 2026
Primitive Types
Schemas for strings, numbers, booleans, dates, and special types
typescript
import * as z from "zod";
z.string();
z.number();
z.boolean();
z.date();
z.bigint();
z.symbol();
z.null();
z.undefined();
z.any();
z.unknown();
z.never();๐ก Zod schemas are immutable โ methods return new schemas instead of mutating
โก Use z.unknown() instead of z.any() to keep type safety throughout your code
๐ z.literal() matches an exact value โ useful for tagged unions and constants
๐ข z.date() validates Date objects, not date strings โ use z.coerce.date() for strings
primitivestypes