Capítulo 9 de 61
Beyond general numbers, Zod has dedicated schemas for integer ranges, arbitrary-precision integers (bigint), and booleans, each with the matching range/sign checks.
z.int(): restricts to JS's safe integer range (Number.isSafeInteger).z.int32(): restricts to the 32-bit signed integer range specifically.z.bigint(): validates JS bigint values, with the same family of checks as numbers: .gt(), .gte() (.min()), .lt(), .lte() (.max()), .positive(), .nonnegative(), .negative(), .nonpositive(), .multipleOf() (.step()) — all using n-suffixed bigint literals.z.boolean(): validates true/false only, no truthy/falsy coercion (use z.coerce.boolean() for that).z.int(); // safe integer range
z.int32(); // int32 range specifically
z.bigint().gt(5n);
z.bigint().gte(5n); // alias .min(5n)
z.bigint().multipleOf(5n); // alias .step(5n)
z.boolean().parse(true); // => true
z.boolean().parse(false); // => false
n suffix for bigint).z.int() when the value must be a whole number within JS's safe integer range; use z.int32() when it must fit a specific 32-bit integer field (e.g. a database column or binary format).z.bigint() checks take n-suffixed bigint literals (5n, not 5) — mixing number and bigint literals is a type error, not a runtime one.z.boolean() is strict — it does not accept truthy/falsy values; that's what z.coerce.boolean() is for.