# 1.0.0

---

### Version Updates
- [Revision 1.0.81](https://github.com/sinclairzx81/typebox/pull/1527)
  - Instantiate Intersect with Context in Value Operations
- [Revision 1.0.80](https://github.com/sinclairzx81/typebox/pull/1524)
  - Retain Ref Options on Instantiate
- [Revision 1.0.79](https://github.com/sinclairzx81/typebox/pull/1518)
  - Fix IsMinLength String Check | 0-Length | No Enumeration
- [Revision 1.0.78](https://github.com/sinclairzx81/typebox/pull/1514)
  - Exclude If on Else Arm for Conditional Schema
- [Revision 1.0.77](https://github.com/sinclairzx81/typebox/pull/1512)
  - Fix TemplateLiteral Infinite Expansion in Value Processors
- [Revision 1.0.76](https://github.com/sinclairzx81/typebox/pull/1509)
  - Derive KeyOf from Record types with TemplateLiteral Keys
- [Revision 1.0.75](https://github.com/sinclairzx81/typebox/pull/1507)
  - Fix Embedded Union Intersect Distribution Rule
- [Revision 1.0.74](https://github.com/sinclairzx81/typebox/pull/1505)
  - Annual License Update
- [Revision 1.0.73](https://github.com/sinclairzx81/typebox/pull/1504)
  - Resolve Socket.Dev False Positive
- [Revision 1.0.72](https://github.com/sinclairzx81/typebox/pull/1503)
  - Use Alias to Export Object Function (React Native)
- [Revision 1.0.71](https://github.com/sinclairzx81/typebox/pull/1499)
  - Additional Inference for XSchema Types
- [Revision 1.0.70](https://github.com/sinclairzx81/typebox/pull/1498)
  - Static Boolean Schematics | Static Template Literal Record Key
- [Revision 1.0.69](https://github.com/sinclairzx81/typebox/pull/1493)
  - Optimize Union Evaluation for Distinct Sets
- [Revision 1.0.68](https://github.com/sinclairzx81/typebox/pull/1492)
  - Export Compile as Default Function
- [Revision 1.0.67](https://github.com/sinclairzx81/typebox/pull/1491)
  - StringGuard Module for Grapheme Cluster Counting
- [Revision 1.0.66](https://github.com/sinclairzx81/typebox/pull/1490)
  - String Length Grapheme Segmentation Polyfill for Intl.Segmenter 
- [Revision 1.0.65](https://github.com/sinclairzx81/typebox/pull/1489)
  - Support Schema Inference for If, Then and Else Keywords
- [Revision 1.0.64](https://github.com/sinclairzx81/typebox/pull/1487)
  - Guard Keys on GlobalThis Instance Values
- [Revision 1.0.63](https://github.com/sinclairzx81/typebox/pull/1486)
  - Support Readonly Keys (Pick, Omit, Index)
- [Revision 1.0.62](https://github.com/sinclairzx81/typebox/pull/1482)
  - Add Missing Uri Option for String Formats
- [Revision 1.0.61](https://github.com/sinclairzx81/typebox/pull/1475)
  - [1463](https://github.com/sinclairzx81/typebox/pull/1463) Fix: Don't skip required undefined properties on object
- [Revision 1.0.60](https://github.com/sinclairzx81/typebox/pull/1474)
  - Fix Parse Inference (Use Encoded Form)
- [Revision 1.0.59](https://github.com/sinclairzx81/typebox/pull/1472)
  - Optimize Schema Creation
- [Revision 1.0.58](https://github.com/sinclairzx81/typebox/pull/1468)
  - Update Initial URI used for Json Schema Resolution
- [Revision 1.0.57](https://github.com/sinclairzx81/typebox/pull/1467)
  - Update TypeScript 5.9.3 | Fix TS 6.0 Nighty Build
- [Revision 1.0.56](https://github.com/sinclairzx81/typebox/pull/1464)
  - Optimize Validator Inference
- [Revision 1.0.55](https://github.com/sinclairzx81/typebox/pull/1456)
  - Expose Type Level Json Pointer Inference API 
- [Revision 1.0.54](https://github.com/sinclairzx81/typebox/pull/1455)
  - Add Internal Type Level Json Pointer Ref / Deref Inference
- [Revision 1.0.53](https://github.com/sinclairzx81/typebox/pull/1451)
  - Fix Handle TabSpaces in Script
- [Revision 1.0.52](https://github.com/sinclairzx81/typebox/pull/1450)
  - Fix Base Modifier Assignment on Instantiate
- [Revision 1.0.51](https://github.com/sinclairzx81/typebox/pull/1447)
  - Add Required Clone function to Base
- [Revision 1.0.50](https://github.com/sinclairzx81/typebox/pull/1443)
  - Escape Known Property Keys on Additional Properties Checks
- [Revision 1.0.49](https://github.com/sinclairzx81/typebox/pull/1436)
  - Readonly Parser Runtime Mapping
- [Revision 1.0.48](https://github.com/sinclairzx81/typebox/pull/1435)
  - Resolve Socket.Dev False Positive | Function Signature Parser
- [Revision 1.0.47](https://github.com/sinclairzx81/typebox/pull/1434)
  - Fix ReadonlyType Fallthrough Case for Non-Mappable types.
- [Revision 1.0.46](https://github.com/sinclairzx81/typebox/pull/1432)
  - Add ReadonlyType Utility Type (Mirroring TypeScript `Readonly<T>`)
- [Revision 1.0.45](https://github.com/sinclairzx81/typebox/pull/1431)
  - Fix for Codec Inference. Prevent Recursive `~codec` keyword matching.
- [Revision 1.0.44](https://github.com/sinclairzx81/typebox/pull/1420)
  - Support RecursiveAnchor and RecursiveRef for Draft 2019-19
- [Revision 1.0.43](https://github.com/sinclairzx81/typebox/pull/1420)
  - Fix Json Pointer | Prevent Sparse Array on Delete
- [Revision 1.0.42](https://github.com/sinclairzx81/typebox/pull/1418)
  - Add RecursiveRef, RecursiveAnchor Guards
  - Revise Json Pointer Module
  - Support Ref / Anchor for Draft 7
- [Revision 1.0.41](https://github.com/sinclairzx81/typebox/pull/1416)
  - Support Sub Schema Value Recovery on Repair
- [Revision 1.0.40](https://github.com/sinclairzx81/typebox/pull/1415)
  - Support Top Level Value Recovery on Repair
- [Revision 1.0.39](https://github.com/sinclairzx81/typebox/pull/1411)
  - Add IsAnchor, IsDynamicAnchor and IsDynamicRef Guards
- [Revision 1.0.38](https://github.com/sinclairzx81/typebox/pull/1410)
  - Json Schema Inference: Progressive Constraint Inference for Items and PrefixItems
- [Revision 1.0.37](https://github.com/sinclairzx81/typebox/pull/1406)
  - Json Schema Inference: Union TypeName and UnevaluatedProperties
- [Revision 1.0.36](https://github.com/sinclairzx81/typebox/pull/1405)
  - Add Immutable Type for Tuple and Array
  - Documentation Updates Literal | Immutable
  - Fix Missing Type Keyword on Literal | AJV Compat
- [Revision 1.0.35](https://github.com/sinclairzx81/typebox/pull/1396)
  - Support Optional SemiColon | KeyOf Any Semantics
- [Revision 1.0.34](https://github.com/sinclairzx81/typebox/pull/1395)
  - Revert Dual Publishing due to TypeScript Playground Automatic Type Acquisition (ATA) Issue
- [Revision 1.0.33](https://github.com/sinclairzx81/typebox/pull/1394)
  - Re-Enable Dual Publishing for ESM and CommonJS
- [Revision 1.0.32](https://github.com/sinclairzx81/typebox/pull/1393)
  - Fix Object Collapse Evaluator for Overlapping Properties (Pick, Omit and Index)
- [Revision 1.0.31](https://github.com/sinclairzx81/typebox/pull/1390)
  - Add Repair Path for Base Types
- [Revision 1.0.30](https://github.com/sinclairzx81/typebox/pull/1386)
  - Finalize Base Schema | Translations
- [Revision 1.0.29](https://github.com/sinclairzx81/typebox/pull/1385)
  - TS 5.0.4: Add Explicit Guard for BaseValidator Callback
- [Revision 1.0.28](https://github.com/sinclairzx81/typebox/pull/1384)
  - Remove Standard Schema Support
- [Revision 1.0.27](https://github.com/sinclairzx81/typebox/pull/1382)
  - Reverse Condition Order for Consistency - Use Variable Left, Constant Right
- [Revision 1.0.26](https://github.com/sinclairzx81/typebox/pull/1381)
  - Draft 2020-12: PrefixItems | UniqueItems Compliance
- [Revision 1.0.25](https://github.com/sinclairzx81/typebox/pull/1380)
  - Fix Qualifier on BuildPrefixItems Code Generation
- [Revision 1.0.24](https://github.com/sinclairzx81/typebox/pull/1379)
  - Use TLocalizedValidationError on AssertError
- [Revision 1.0.23](https://github.com/sinclairzx81/typebox/pull/1378)
  - Revert Standard Schema Error Path Translation | Provide Translation Via Example
- [Revision 1.0.22](https://github.com/sinclairzx81/typebox/pull/1375)
  - Resolve Socket.Dev False Positive
- [Revision 1.0.21](https://github.com/sinclairzx81/typebox/pull/1374)
  - Enable Trusted Publishing: No Functional Changes
- [Revision 1.0.20](https://github.com/sinclairzx81/typebox/pull/1372)
  - Standard Schema Infer for Deep Json Schema Embedding
- [Revision 1.0.19](https://github.com/sinclairzx81/typebox/pull/1371)
  - Standard Schema Type Assertion Fix TS 5.0.4
- [Revision 1.0.18](https://github.com/sinclairzx81/typebox/pull/1369)
  - Standard Schema Error Path Translation
- [Revision 1.0.17](https://github.com/sinclairzx81/typebox/pull/1366)
  - Use Exact Standard Schema Interface
- [Revision 1.0.16](https://github.com/sinclairzx81/typebox/pull/1358)
  - Inference Ref Stack | Cyclic Inference Termination
- [Revision 1.0.15](https://github.com/sinclairzx81/typebox/pull/1346)
  - Specify Types for AssertError Cause Properties
- [Revision 1.0.14](https://github.com/sinclairzx81/typebox/pull/1349)
  - Support Readonly Value Array on Enum Constructor.
- [Revision 1.0.13](https://github.com/sinclairzx81/typebox/pull/1348)
  - Support Require(ESM) package resolution for Node 20+.
- [Revision 1.0.12](https://github.com/sinclairzx81/typebox/pull/1347)
  - Export Json Schema Guards
  - Export DecodeUnsafe and EncodeUnsafe Functions
  - [1345](https://github.com/sinclairzx81/typebox/issues/1345) Fix Assert Function Signature
  - [1343](https://github.com/sinclairzx81/typebox/issues/1343) Fix Optional | Union Handling for Clean
- [Revision 1.0.11](https://github.com/sinclairzx81/typebox/pull/1342)
  - Use IsOptionalUndefined Property Guard for Decode and Encode
- [Revision 1.0.10](https://github.com/sinclairzx81/typebox/pull/1340)
  - Use IsOptionalUndefined Property Guard for Convert
- [Revision 1.0.9](https://github.com/sinclairzx81/typebox/pull/1337)
  - Support ExactOptionalPropertyTypes Semantics
- [Revision 1.0.8](https://github.com/sinclairzx81/typebox/pull/1334)
  - Export StaticDecode, StaticEncode and StaticParse as Defaults
- [Revision 1.0.7](https://github.com/sinclairzx81/typebox/pull/1331)
  - Optimize Codecs for Compiled Validators
- [Revision 1.0.6](https://github.com/sinclairzx81/typebox/pull/1330)
  - Encode Pipeline | Clone | Class Instance Detection
- [Revision 1.0.5](https://github.com/sinclairzx81/typebox/pull/1327)
  - Support Sub Schema Deref via TLocalizedValidationError 
- [Revision 1.0.4](https://github.com/sinclairzx81/typebox/pull/1324)
  - Allow BigInt for MultipleOf Constraint
- [Revision 1.0.3](https://github.com/sinclairzx81/typebox/pull/1321)
  - Add Variadic Signature Inference
- [Revision 1.0.2](https://github.com/sinclairzx81/typebox/pull/1320)
  - Remove Unreachable Assertion on Decode
- [Revision 1.0.1](https://github.com/sinclairzx81/typebox/pull/1315)
  - Ensure Infer Type is Cached on TUnsafe


---

A Runtime Type System for JavaScript

# Contents

- [Install](#Install)
- [Legacy](#Legacy)
- [Features](#Features)
  - [TypeScript](#TypeScript)
  - [Compiler](#Compiler)
  - [Formats](#Formats)
  - [Locales](#Locales)
- [Types](#Types)
  - [Enum](#Enum)
  - [Module](#Module)
  - [Interface](#Interface)
  - [Evaluate](#Evaluate)
  - [Refine](#Refine)
- [Migration](#Migration)


<a name="Install"></a>

# Install

TypeBox 1.0 will be published under the `typebox` NPM package name.

```bash
$ npm install typebox --save                         # TypeBox 1.0.0

$ npm install @sinclair/typebox --save               # TypeBox 0.34.x
```

<a name="Legacy"></a>

# Legacy

TypeBox will provide a legacy support for users on pre-1.0 versions. The @sinclair/typebox package will continue receive updates into 2026 under the `0.34.x` version but will be limited to bug fixes only. The @sinclair/typebox package will eventually be synchronized with the 1.0 package where-in both will adopt post-1.0 semantic versioning. 

> The support window for `0.34.x` is yet to be determined but will be reviewed early-mid 2026. The decision to sync packages will be based on general 1.0 adoption observed at the time. Syncing packages is not anticipated until mid-2026 at the earliest.

# Features

The following features are supported in TypeBox 1.0.

<a name="TypeScript"></a>

## TypeScript

Version 1.0 adds a new Script function that offers runtime TypeScript emulation. This feature was developed in preparation of TypeScript 7 native which offers accelerated language service performance. 

### Example

The following shows Script usage.

```typescript
// Script

const T = Type.Script(`{ 
  x: number, 
  y: number, 
  z: number 
}`)

// Transform

const S = Type.Script({ T }, `{ 
  [K in keyof T as Uppercase<K>]: T[K] | null 
}`)

// Introspect

S.properties.X.anyOf[0]                             // { type: 'number' }
S.properties.X.anyOf[1]                             // { type: 'null' }
```

<a name="Compiler"></a>

## Compiler

Version 1.0 adds a new compiler for Json Schema. The 1.0 compiler has been redesigned from the ground up to support direct compilation of Json Schema. 

### Example

The 1.0 compiler supports all of the following.

```typescript
import { Compile } from 'typebox/compile'

// Unified Compile: TypeBox | Json Schema | Standard Schema 

const X = Compile(Type.Script(`1 | 2 | 3`))

const Y = Compile({ anyOf: [{ const: 1 }, { const: 2 }, { const: 3 }] })

// Unified Parse and Inference

const A = X.Parse(1)                                // const A: 1 | 2 | 3

const B = Y.Parse(2)                                // const B: 1 | 2 | 3
```


<a name="Formats"></a>

## Formats

TypeBox 1.0 adds a full suite of RFC-compliant string format checkers. The initial formats provided correspond to those referenced in the Json Schema specification. The formats are automatically configured for schema validation but can be called directly via submodule import.

### Example

The following validates an Email.

```typescript
const T = Type.String({ format: 'email' })

const R = Value.Check(T, 'user@domain.com')         // true
```

The following validates an Email via submodule import.

```typescript

import Format from 'typebox/format'

const R = Format.IsEmail('user@domain.com')         // true
```

<a name="Locales"></a>

## Locales

Versions 1.0 adds error message translations for 40+ languages. 

### Example

Locales can be configured via the System submodule.

```typescript
import { Locale } from 'typebox/system'

const T = Type.Number()

// ----------

Locale.Set(Locale.en_US)                            // English - United States

Value.Errors(T, 'not a number')                     // [{ ...message: 'must be number' }]

// ----------

Locale.Set(Locale.ko_KR)                            // Korean - South Korea

Value.Errors(T, 'not a number')                     // [{ ...message: 'number 이어야 합니다' }]

// ----------

Locale.Set(Locale.zh_Hans)                          // Chinese - Simplified

Value.Errors(T, 'not a number')                     // [{ ...message: '必须是 number' }]
```

# Types

The following types are available in TypeBox 1.0

<a name="Enum"></a>

## Enum

Version 1.0 adds compositor support for `enum` schema representations. 

```typescript
const A = Type.Enum(['A', 'B', 'C'])                // const A = {
                                                    //   enum: ['A', 'B', 'C']
                                                    // }

type A = Static<typeof A>                           // type A = 'A' | 'B' | 'C'
```

<a name="Module"></a>

## Module

Version 1.0 adds several new features to Module including immediate type return, automatic reference inlining and cyclic type detection.

### Example

The following shows immediate type return and reference inlining.

```typescript
const { A, B, C } = Type.Module({
  A: Type.Number(),                                 // const A: TNumber

  B: Type.String(),                                 // const B: TString

  C: Type.Object({                                  // const C: TObject<{
    a: Type.Ref('A'),                               //   TNumber, // <--- inline
    b: Type.Ref('B'),                               //   TString  // <--- inline
  })                                                // }>
})

```

<a name="Interface"></a>

## Interface

Version 1.0 adds a Interface type.

### Example

The following creates three interfaces where `C` extends `A` and `B`.

```typescript
const A = Type.Interface([], {                      // const A: TObject<{
  a: Type.Number()                                  //   a: TNumber
})                                                  // }>

const B = Type.Interface([], {                      // const B: TObject<{
  b: Type.Number()                                  //   b: TNumber
 })                                                 // }>

const C = Type.Interface([A, B], {                  // const C: TObject<{
  c: Type.Number()                                  //   a: TNumber,
})                                                  //   b: TNumber,
                                                    //   c: TNumber
                                                    // }
```

<a name="Evaluate"></a>

## Evaluate

Version 1.0 adds a new Evaluate type. This type can be used to evaluate logical Intersect and Union types into normalized forms. 

### Example

The following evaluates an intersection of Objects, returning a single Object.

```typescript
const T = Type.Intersect([                     // const T: TIntersect<[
  Type.Object({ x: Type.Number() }),           //   TObject<{ x: TNumber }>,
  Type.Object({ y: Type.Number() }),           //   TObject<{ y: TNumber }>,
  Type.Object({ z: Type.Number() })            //   TObject<{ z: TNumber }>,
])                                             // ]>


const S = Type.Evaluate(T)                     // const S: TObject<{
                                               //  x: TNumber,
                                               //  y: TNumber,
                                               //  z: TNumber
                                               // }>
```

<a name="Refine"></a>

## Refine

Version 1.0 adds a Refine function. 

### Example

The following uses Refine to test that properties `x` and `y` are equal with optional error message.

```typescript
const T = Type.Refine(Type.Object({
  x: Type.Number(),
  y: Type.Number()
}), value => value.x === value.y, 'x should equal w')


const R1 = Value.Check(T, { x: 1, y: 1 })           // true
const R2 = Value.Check(T, { x: 1, y: 2 })           // false
```

<a name="Migration"></a>

## Migration

Version 1.0 is a complete rebuild of TypeBox. While attempts have been made to retain the pre-1.0 API surface, there are several significant breaking changes that warrant a major revision tick. A migration guide has been prepared that documents upgrading from `0.34.x` to `1.0.0`. The guide can be found at the link below.

[TypeBox 1.0 Migration Guide](/changelog/1.0.0-migration.md)
