Skip to content

x-to-zod / ZodBuilder / build

Variable: build

ts
const build: V4BuildAPI = buildV4;

Defined in: src/ZodBuilder/index.ts:128

The default Zod v4 builder API.

A collection of factory methods — build.string(), build.object(), etc. — that emit Builder instances rather than real Zod schemas. Each method mirrors its counterpart on the z namespace but returns a code-generating builder instead. Import build from x-to-zod/v3 or x-to-zod/v4 to get a version-constrained variant of the API.

Example

ts
import { ZodBuilder } from 'x-to-zod';
const expr = ZodBuilder.build.string().optional().text();
// => 'z.string().optional()'

Released under the ISC License.