TypeBox

Json Schema Type Builder with Static Type Resolution for TypeScript



License

Overview

TypeBox is a runtime type builder that creates in-memory Json Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type that can be statically checked by TypeScript and runtime asserted using standard Json Schema validation.

See Overview →

Install

$ npm install @alkdev/typebox                     # TypeBox 0.x - Long Term Support

$ npm install typebox                               # TypeBox 1.x - Latest

See Installation →

Quick Start

import { Type, type Static } from "@alkdev/typebox";

const T = Type.Object({
  x: Type.Number(),
  y: Type.Number(),
  z: Type.Number(),
});

type T = Static<typeof T>;

See Usage →

Documentation

Types

Values

Syntax

Type System

Other

License

MIT

Description
No description provided
Readme 2.1 MiB
Languages
TypeScript 99.8%
JavaScript 0.2%