API Reference

@sinclair/typebox

JSON Schema type builder with compile-time inference, runtime validation, and zero-dependency AST for TypeScript.

Official Documentation ↗
CompatibilityThis documentation covers version v0.32. Check the official docs for the latest API surface.

Installation

npmnpm install @sinclair/typebox

Methods

@sinclair/typebox is json schema type builder with compile-time inference, runtime validation, and zero-dependency ast for typescript. This page documents the core methods, installation, and common usage patterns for the current stable release.

Installation

Install @sinclair/typebox with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.

Core methods

The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v0.32 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.

Frequently asked questions

The faq section in the frontmatter answers the most common questions about @sinclair/typebox, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.

FAQ

Does it emit standard JSON Schema?
Yes. Type.* builders produce standard JSON Schema objects; use them with any JSON Schema validator.
How is it different from Zod?
TypeBox produces JSON Schema as the source of truth; Zod produces a runtime validator with optional JSON Schema export.
Is it tree-shakeable?
Yes. It is zero-dependency and ESM; import only the types you use.