f8b2cdd5a42e60565a2c3923a9c572d82698578a
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
- Json Types
- JavaScript Types
- Options
- Properties
- Generic Types
- Recursive Types
- Module Types
- Template Literal Types
- Indexed Access Types
- Mapped Types
- Conditional Types
- Transform Types
- Unsafe Types
- TypeGuard
Values
- Assert
- Create
- Clone
- Check
- Convert
- Clean
- Default
- Cast
- Decode / Encode
- Parse
- Equal
- Hash
- Diff / Patch
- Errors
- Mutate
- Pointer
Syntax
Type System
- TypeRegistry
- TypeCheck — Ajv, TypeCompiler
- TypeMap
- TypeSystem
- Error Function
Other
License
MIT
Description
Languages
TypeScript
99.8%
JavaScript
0.2%