{"_id":"@scalar/typebox","_rev":"10-5fa607ac288d44bc7ac7662058eb1b30","name":"@scalar/typebox","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@scalar/typebox","version":"0.1.0","keywords":["typescript","json-schema","validate","typecheck"],"author":{"name":"sinclairzx81"},"license":"MIT","_id":"@scalar/typebox@0.1.0","maintainers":[{"name":"amritkahlon","email":"amritkahlon00@gmail.com"},{"name":"cameronrohani","email":"cam@scalar.com"},{"name":"marclave","email":"marc@scalar.com"},{"name":"tommastro","email":"tom@scalar.com"},{"name":"scalar_geoff","email":"geoff@scalar.com"},{"name":"hwkr","email":"bn@hwkr.me"},{"name":"mason-little","email":"mason@scalar.com"},{"name":"hanspagel","email":"mail@hanspagel.com"},{"name":"bgrcs","email":"bruno@grcs.pm"},{"name":"scalar-machine","email":"machine@scalar.com"}],"homepage":"https://github.com/sinclairzx81/typebox#readme","bugs":{"url":"https://github.com/sinclairzx81/typebox/issues"},"dist":{"shasum":"a9f473699f916e1fab90ca93e75e33449704fa81","tarball":"https://registry.npmjs.org/@scalar/typebox/-/typebox-0.1.0.tgz","fileCount":1070,"integrity":"sha512-stgEhiqCvQ5gLsiEHMkzIwNECw1aQyrPgN6Z9OqlTZkz5J4M2F7CbS55ojfu5hl6QdX8UsqjDQihsqjZcskYfQ==","signatures":[{"sig":"MEYCIQDJrBVRWc6h/l+k0nFug5PaZOGQsp6dnspIGyFAvqophgIhAJO69Azb4GJgHInLXBz9iHgb8bv43W4jw6brmFW3mRFu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1874467},"main":"./build/cjs/index.js","_from":"file:scalar-typebox-0.1.0.tgz","types":"./build/cjs/index.d.ts","esm.sh":{"bundle":false},"module":"./build/esm/index.mjs","exports":{".":{"import":{"types":"./build/esm/index.d.mts","default":"./build/esm/index.mjs"},"require":{"types":"./build/cjs/index.d.ts","default":"./build/cjs/index.js"}},"./type":{"import":{"types":"./build/esm/type/index.d.mts","default":"./build/esm/type/index.mjs"},"require":{"types":"./build/cjs/type/index.d.ts","default":"./build/cjs/type/index.js"}},"./value":{"import":{"types":"./build/esm/value/index.d.mts","default":"./build/esm/value/index.mjs"},"require":{"types":"./build/cjs/value/index.d.ts","default":"./build/cjs/value/index.js"}},"./errors":{"import":{"types":"./build/esm/errors/index.d.mts","default":"./build/esm/errors/index.mjs"},"require":{"types":"./build/cjs/errors/index.d.ts","default":"./build/cjs/errors/index.js"}},"./parser":{"import":{"types":"./build/esm/parser/index.d.mts","default":"./build/esm/parser/index.mjs"},"require":{"types":"./build/cjs/parser/index.d.ts","default":"./build/cjs/parser/index.js"}},"./syntax":{"import":{"types":"./build/esm/syntax/index.d.mts","default":"./build/esm/syntax/index.mjs"},"require":{"types":"./build/cjs/syntax/index.d.ts","default":"./build/cjs/syntax/index.js"}},"./system":{"import":{"types":"./build/esm/system/index.d.mts","default":"./build/esm/system/index.mjs"},"require":{"types":"./build/cjs/system/index.d.ts","default":"./build/cjs/system/index.js"}},"./compiler":{"import":{"types":"./build/esm/compiler/index.d.mts","default":"./build/esm/compiler/index.mjs"},"require":{"types":"./build/cjs/compiler/index.d.ts","default":"./build/cjs/compiler/index.js"}}},"scripts":{"test":"echo test"},"_npmUser":{"name":"scalar_geoff","email":"geoff@scalar.com"},"_resolved":"/home/runner/work/typebox/typebox/target/build/scalar-typebox-0.1.0.tgz","_integrity":"sha512-stgEhiqCvQ5gLsiEHMkzIwNECw1aQyrPgN6Z9OqlTZkz5J4M2F7CbS55ojfu5hl6QdX8UsqjDQihsqjZcskYfQ==","repository":{"url":"git+https://github.com/sinclairzx81/typebox.git","type":"git"},"_npmVersion":"10.8.2","description":"Json Schema Type Builder with Static Type Resolution for TypeScript","directories":{},"sideEffects":["./build/esm/type/registry/format.mjs","./build/esm/type/registry/type.mjs","./build/esm/type/system/policy.mjs","./build/cjs/type/registry/format.js","./build/cjs/type/registry/type.js","./build/cjs/type/system/policy.js"],"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/typebox_0.1.0_1756412748683_0.24253149066909607","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@scalar/typebox","version":"0.1.1","keywords":["typescript","json-schema","validate","typecheck"],"author":{"name":"sinclairzx81"},"license":"MIT","_id":"@scalar/typebox@0.1.1","maintainers":[{"name":"amritkahlon","email":"amritkahlon00@gmail.com"},{"name":"cameronrohani","email":"cam@scalar.com"},{"name":"marclave","email":"marc@scalar.com"},{"name":"tommastro","email":"tom@scalar.com"},{"name":"scalar_geoff","email":"geoff@scalar.com"},{"name":"hwkr","email":"bn@hwkr.me"},{"name":"mason-little","email":"mason@scalar.com"},{"name":"hanspagel","email":"mail@hanspagel.com"},{"name":"bgrcs","email":"bruno@grcs.pm"},{"name":"scalar-machine","email":"machine@scalar.com"}],"homepage":"https://github.com/sinclairzx81/typebox#readme","bugs":{"url":"https://github.com/sinclairzx81/typebox/issues"},"dist":{"shasum":"68ef8004506e453e0839c422e5d96655dabee2b6","tarball":"https://registry.npmjs.org/@scalar/typebox/-/typebox-0.1.1.tgz","fileCount":1070,"integrity":"sha512-Mhhubu4zj1PiXhtgvNbz34zniedtO6PYdD80haMkIjOJwV9aWejxXILr2elHGBMsLfdhH3s9qxux6TL6X8Q6/Q==","signatures":[{"sig":"MEUCIC3doKuqAdpPvmldb2s4K2AUancSO57JN3xwzm4sdpIJAiEAgUOpGpuvV7jt7pdy0b+7ZiLhpfO/rZzEm8dCZ4pXWBw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1874651},"main":"./build/cjs/index.js","_from":"file:scalar-typebox-0.1.1.tgz","types":"./build/cjs/index.d.ts","esm.sh":{"bundle":false},"module":"./build/esm/index.mjs","exports":{".":{"import":{"types":"./build/esm/index.d.mts","default":"./build/esm/index.mjs"},"require":{"types":"./build/cjs/index.d.ts","default":"./build/cjs/index.js"}},"./type":{"import":{"types":"./build/esm/type/index.d.mts","default":"./build/esm/type/index.mjs"},"require":{"types":"./build/cjs/type/index.d.ts","default":"./build/cjs/type/index.js"}},"./value":{"import":{"types":"./build/esm/value/index.d.mts","default":"./build/esm/value/index.mjs"},"require":{"types":"./build/cjs/value/index.d.ts","default":"./build/cjs/value/index.js"}},"./errors":{"import":{"types":"./build/esm/errors/index.d.mts","default":"./build/esm/errors/index.mjs"},"require":{"types":"./build/cjs/errors/index.d.ts","default":"./build/cjs/errors/index.js"}},"./parser":{"import":{"types":"./build/esm/parser/index.d.mts","default":"./build/esm/parser/index.mjs"},"require":{"types":"./build/cjs/parser/index.d.ts","default":"./build/cjs/parser/index.js"}},"./syntax":{"import":{"types":"./build/esm/syntax/index.d.mts","default":"./build/esm/syntax/index.mjs"},"require":{"types":"./build/cjs/syntax/index.d.ts","default":"./build/cjs/syntax/index.js"}},"./system":{"import":{"types":"./build/esm/system/index.d.mts","default":"./build/esm/system/index.mjs"},"require":{"types":"./build/cjs/system/index.d.ts","default":"./build/cjs/system/index.js"}},"./compiler":{"import":{"types":"./build/esm/compiler/index.d.mts","default":"./build/esm/compiler/index.mjs"},"require":{"types":"./build/cjs/compiler/index.d.ts","default":"./build/cjs/compiler/index.js"}}},"scripts":{"test":"echo test"},"_npmUser":{"name":"scalar_geoff","email":"geoff@scalar.com"},"_resolved":"/home/runner/work/typebox/typebox/target/build/scalar-typebox-0.1.1.tgz","_integrity":"sha512-Mhhubu4zj1PiXhtgvNbz34zniedtO6PYdD80haMkIjOJwV9aWejxXILr2elHGBMsLfdhH3s9qxux6TL6X8Q6/Q==","repository":{"url":"git+https://github.com/sinclairzx81/typebox.git","type":"git"},"_npmVersion":"10.8.2","description":"Json Schema Type Builder with Static Type Resolution for TypeScript","directories":{},"sideEffects":["./build/esm/type/registry/format.mjs","./build/esm/type/registry/type.mjs","./build/esm/type/system/policy.mjs","./build/cjs/type/registry/format.js","./build/cjs/type/registry/type.js","./build/cjs/type/system/policy.js"],"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/typebox_0.1.1_1756819152496_0.240732610430491","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@scalar/typebox","version":"0.1.2","keywords":["typescript","json-schema","validate","typecheck"],"author":{"name":"sinclairzx81"},"license":"MIT","_id":"@scalar/typebox@0.1.2","maintainers":[{"name":"amritkahlon","email":"amritkahlon00@gmail.com"},{"name":"cameronrohani","email":"cam@scalar.com"},{"name":"marclave","email":"marc@scalar.com"},{"name":"tommastro","email":"tom@scalar.com"},{"name":"scalar_geoff","email":"geoff@scalar.com"},{"name":"hwkr","email":"bn@hwkr.me"},{"name":"mason-little","email":"mason@scalar.com"},{"name":"hanspagel","email":"mail@hanspagel.com"},{"name":"bgrcs","email":"bruno@grcs.pm"},{"name":"scalar-machine","email":"machine@scalar.com"}],"homepage":"https://github.com/sinclairzx81/typebox#readme","bugs":{"url":"https://github.com/sinclairzx81/typebox/issues"},"dist":{"shasum":"5fd76ee4fdf3677996c61826916894cc405c3550","tarball":"https://registry.npmjs.org/@scalar/typebox/-/typebox-0.1.2.tgz","fileCount":1070,"integrity":"sha512-rL15K8bgmvEJvKabw1vUz4MbGKmkXltBEhejFm9FQZs4OoKQWYAk2qCd8em4WOJN2JqJmmNBlWbqhGliuoDwnQ==","signatures":[{"sig":"MEQCICrMW+mfwXTLc8Mhitp1TNEIjFrZImTGazZdJR2rP5CpAiARuYLb1hUwHlWFSIpCIkgCPaWGai4KHdf8OtVwBDPUlA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1874651},"main":"./build/cjs/index.js","_from":"file:scalar-typebox-0.1.2.tgz","types":"./build/cjs/index.d.ts","esm.sh":{"bundle":false},"module":"./build/esm/index.mjs","exports":{".":{"import":{"types":"./build/esm/index.d.mts","default":"./build/esm/index.mjs"},"require":{"types":"./build/cjs/index.d.ts","default":"./build/cjs/index.js"}},"./type":{"import":{"types":"./build/esm/type/index.d.mts","default":"./build/esm/type/index.mjs"},"require":{"types":"./build/cjs/type/index.d.ts","default":"./build/cjs/type/index.js"}},"./value":{"import":{"types":"./build/esm/value/index.d.mts","default":"./build/esm/value/index.mjs"},"require":{"types":"./build/cjs/value/index.d.ts","default":"./build/cjs/value/index.js"}},"./errors":{"import":{"types":"./build/esm/errors/index.d.mts","default":"./build/esm/errors/index.mjs"},"require":{"types":"./build/cjs/errors/index.d.ts","default":"./build/cjs/errors/index.js"}},"./parser":{"import":{"types":"./build/esm/parser/index.d.mts","default":"./build/esm/parser/index.mjs"},"require":{"types":"./build/cjs/parser/index.d.ts","default":"./build/cjs/parser/index.js"}},"./syntax":{"import":{"types":"./build/esm/syntax/index.d.mts","default":"./build/esm/syntax/index.mjs"},"require":{"types":"./build/cjs/syntax/index.d.ts","default":"./build/cjs/syntax/index.js"}},"./system":{"import":{"types":"./build/esm/system/index.d.mts","default":"./build/esm/system/index.mjs"},"require":{"types":"./build/cjs/system/index.d.ts","default":"./build/cjs/system/index.js"}},"./compiler":{"import":{"types":"./build/esm/compiler/index.d.mts","default":"./build/esm/compiler/index.mjs"},"require":{"types":"./build/cjs/compiler/index.d.ts","default":"./build/cjs/compiler/index.js"}}},"scripts":{"test":"echo test"},"_npmUser":{"name":"hanspagel","email":"mail@hanspagel.com"},"_resolved":"/home/runner/work/typebox/typebox/target/build/scalar-typebox-0.1.2.tgz","_integrity":"sha512-rL15K8bgmvEJvKabw1vUz4MbGKmkXltBEhejFm9FQZs4OoKQWYAk2qCd8em4WOJN2JqJmmNBlWbqhGliuoDwnQ==","repository":{"url":"git+https://github.com/sinclairzx81/typebox.git","type":"git"},"_npmVersion":"10.8.2","description":"Json Schema Type Builder with Static Type Resolution for TypeScript","directories":{},"sideEffects":["./build/esm/type/registry/format.mjs","./build/esm/type/registry/type.mjs","./build/esm/type/system/policy.mjs","./build/cjs/type/registry/format.js","./build/cjs/type/registry/type.js","./build/cjs/type/system/policy.js"],"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/typebox_0.1.2_1767706002491_0.2052097218568254","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@scalar/typebox","version":"0.1.3","keywords":["typescript","json-schema","validate","typecheck"],"author":{"name":"sinclairzx81"},"license":"MIT","_id":"@scalar/typebox@0.1.3","maintainers":[{"name":"amritkahlon","email":"amritkahlon00@gmail.com"},{"name":"cameronrohani","email":"cam@scalar.com"},{"name":"marclave","email":"marc@scalar.com"},{"name":"tommastro","email":"tom@scalar.com"},{"name":"scalar_geoff","email":"geoff@scalar.com"},{"name":"hwkr","email":"bn@hwkr.me"},{"name":"mason-little","email":"mason@scalar.com"},{"name":"hanspagel","email":"mail@hanspagel.com"},{"name":"bgrcs","email":"bruno@grcs.pm"},{"name":"scalar-machine","email":"machine@scalar.com"}],"homepage":"https://github.com/sinclairzx81/typebox#readme","bugs":{"url":"https://github.com/sinclairzx81/typebox/issues"},"dist":{"shasum":"0959377d9ddbf73c97a3ac8ba8af672061863945","tarball":"https://registry.npmjs.org/@scalar/typebox/-/typebox-0.1.3.tgz","fileCount":1070,"integrity":"sha512-lU055AUccECZMIfGA0z/C1StYmboAYIPJLDFBzOO81yXBi35Pxdq+I4fWX6iUZ8qcoHneiLGk9jAUM1rA93iEg==","signatures":[{"sig":"MEUCIQDkTKUaLaIYikZbSBTQjepFAx2BX//mXmw9U77hgFCINAIgF3MfRuD5oFPPF5RNMsOmIJlu9Tbl+v8AkT6jLHWWRjQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1875327},"main":"./build/cjs/index.js","_from":"file:scalar-typebox-0.1.3.tgz","types":"./build/cjs/index.d.ts","esm.sh":{"bundle":false},"module":"./build/esm/index.mjs","exports":{".":{"import":{"types":"./build/esm/index.d.mts","default":"./build/esm/index.mjs"},"require":{"types":"./build/cjs/index.d.ts","default":"./build/cjs/index.js"}},"./type":{"import":{"types":"./build/esm/type/index.d.mts","default":"./build/esm/type/index.mjs"},"require":{"types":"./build/cjs/type/index.d.ts","default":"./build/cjs/type/index.js"}},"./value":{"import":{"types":"./build/esm/value/index.d.mts","default":"./build/esm/value/index.mjs"},"require":{"types":"./build/cjs/value/index.d.ts","default":"./build/cjs/value/index.js"}},"./errors":{"import":{"types":"./build/esm/errors/index.d.mts","default":"./build/esm/errors/index.mjs"},"require":{"types":"./build/cjs/errors/index.d.ts","default":"./build/cjs/errors/index.js"}},"./parser":{"import":{"types":"./build/esm/parser/index.d.mts","default":"./build/esm/parser/index.mjs"},"require":{"types":"./build/cjs/parser/index.d.ts","default":"./build/cjs/parser/index.js"}},"./syntax":{"import":{"types":"./build/esm/syntax/index.d.mts","default":"./build/esm/syntax/index.mjs"},"require":{"types":"./build/cjs/syntax/index.d.ts","default":"./build/cjs/syntax/index.js"}},"./system":{"import":{"types":"./build/esm/system/index.d.mts","default":"./build/esm/system/index.mjs"},"require":{"types":"./build/cjs/system/index.d.ts","default":"./build/cjs/system/index.js"}},"./compiler":{"import":{"types":"./build/esm/compiler/index.d.mts","default":"./build/esm/compiler/index.mjs"},"require":{"types":"./build/cjs/compiler/index.d.ts","default":"./build/cjs/compiler/index.js"}}},"scripts":{"test":"echo test"},"_npmUser":{"name":"hanspagel","email":"mail@hanspagel.com"},"_resolved":"/home/runner/work/typebox/typebox/target/build/scalar-typebox-0.1.3.tgz","_integrity":"sha512-lU055AUccECZMIfGA0z/C1StYmboAYIPJLDFBzOO81yXBi35Pxdq+I4fWX6iUZ8qcoHneiLGk9jAUM1rA93iEg==","repository":{"url":"git+https://github.com/sinclairzx81/typebox.git","type":"git"},"_npmVersion":"10.8.2","description":"Json Schema Type Builder with Static Type Resolution for TypeScript","directories":{},"sideEffects":["./build/esm/type/registry/format.mjs","./build/esm/type/registry/type.mjs","./build/esm/type/system/policy.mjs","./build/cjs/type/registry/format.js","./build/cjs/type/registry/type.js","./build/cjs/type/system/policy.js"],"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/typebox_0.1.3_1767754776127_0.8737983860565293","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-08-28T20:25:48.542Z","modified":"2026-08-14T19:30:24.920Z","0.35.3":"2025-08-28T20:20:12.043Z","0.1.0":"2025-08-28T20:25:48.935Z","0.1.1":"2025-09-02T13:19:12.951Z","0.1.2":"2026-01-06T13:26:42.668Z","0.1.3":"2026-01-07T02:59:36.343Z"},"bugs":{"url":"https://github.com/sinclairzx81/typebox/issues"},"author":{"name":"sinclairzx81"},"license":"MIT","homepage":"https://github.com/sinclairzx81/typebox#readme","keywords":["typescript","json-schema","validate","typecheck"],"repository":{"url":"git+https://github.com/sinclairzx81/typebox.git","type":"git"},"description":"Json Schema Type Builder with Static Type Resolution for TypeScript","maintainers":[{"email":"cam@scalar.com","name":"cameronrohani"},{"email":"marc@scalar.com","name":"marclave"},{"email":"geoff@scalar.com","name":"scalar_geoff"},{"email":"bn@hwkr.me","name":"hwkr"},{"email":"mail@hanspagel.com","name":"hanspagel"},{"email":"amrit+spam@hockey-community.com","name":"amritk"},{"email":"machine@scalar.com","name":"scalar-machine"}],"readme":"<div align='center'>\n\n<h1>TypeBox</h1>\n\n<p>Json Schema Type Builder with Static Type Resolution for TypeScript</p>\n\n<img src=\"https://raw.githubusercontent.com/sinclairzx81/typebox/refs/heads/master/typebox.png\" />\n\n<br />\n<br />\n\n[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox)\n[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox)\n[![Build](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n</div>\n\n<a name=\"Install\"></a>\n\n## Install\n\n```bash\n$ npm install @sinclair/typebox --save\n```\n\n## Example\n\n```typescript\nimport { Type, type Static } from '@sinclair/typebox'\n\nconst T = Type.Object({                              // const T = {\n  x: Type.Number(),                                  //   type: 'object',\n  y: Type.Number(),                                  //   required: ['x', 'y', 'z'],\n  z: Type.Number()                                   //   properties: {\n})                                                   //     x: { type: 'number' },\n                                                     //     y: { type: 'number' },\n                                                     //     z: { type: 'number' }\n                                                     //   }\n                                                     // }\n\ntype T = Static<typeof T>                            // type T = {\n                                                     //   x: number,\n                                                     //   y: number,\n                                                     //   z: number\n                                                     // }\n```\n\n\n<a name=\"Overview\"></a>\n\n## Overview\n\nTypeBox 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.\n\nThis library is designed to allow Json Schema to compose similar to how types compose within TypeScript's type system. It can be used as a simple tool to build up complex schematics or integrated into REST and RPC services to help validate data received over the wire.\n\nLicense MIT\n\n## Contents\n- [Install](#install)\n- [Overview](#overview)\n- [Usage](#usage)\n- [Types](#types)\n  - [Json](#types-json)\n  - [JavaScript](#types-javascript)\n  - [Options](#types-options)\n  - [Properties](#types-properties)\n  - [Generics](#types-generics)\n  - [Recursive](#types-recursive)\n  - [Modules](#types-modules)\n  - [Template Literal](#types-template-literal)\n  - [Indexed](#types-indexed)\n  - [Mapped](#types-mapped)\n  - [Conditional](#types-conditional)\n  - [Transform](#types-transform)\n  - [Guard](#types-guard)\n  - [Unsafe](#types-unsafe)\n- [Values](#values)\n  - [Assert](#values-assert)\n  - [Create](#values-create)\n  - [Clone](#values-clone)\n  - [Check](#values-check)\n  - [Convert](#values-convert)\n  - [Default](#values-default)\n  - [Clean](#values-clean)\n  - [Cast](#values-cast)\n  - [Decode](#values-decode)\n  - [Encode](#values-decode)\n  - [Parse](#values-parse)\n  - [Equal](#values-equal)\n  - [Hash](#values-hash)\n  - [Diff](#values-diff)\n  - [Patch](#values-patch)\n  - [Errors](#values-errors)\n  - [Mutate](#values-mutate)\n  - [Pointer](#values-pointer)\n- [Syntax](#syntax)\n  - [Create](#syntax-create)\n  - [Parameters](#syntax-parameters)\n  - [Generics](#syntax-generics)\n  - [Options](#syntax-options)\n  - [NoInfer](#syntax-no-infer)\n- [TypeRegistry](#typeregistry)\n  - [Type](#typeregistry-type)\n  - [Format](#typeregistry-format)\n- [TypeCheck](#typecheck)\n  - [Ajv](#typecheck-ajv)\n  - [TypeCompiler](#typecheck-typecompiler)\n- [TypeMap](#typemap)\n  - [Usage](#typemap-usage)\n- [TypeSystem](#typesystem)\n  - [Policies](#typesystem-policies)\n- [Error Function](#error-function)\n- [Workbench](#workbench)\n- [Codegen](#codegen)\n- [Ecosystem](#ecosystem)\n- [Benchmark](#benchmark)\n  - [Compile](#benchmark-compile)\n  - [Validate](#benchmark-validate)\n  - [Compression](#benchmark-compression)\n- [Contribute](#contribute)\n\n<a name=\"usage\"></a>\n\n## Usage\n\nThe following shows general usage.\n\n```typescript\nimport { Type, type Static } from '@sinclair/typebox'\n\n//--------------------------------------------------------------------------------------------\n//\n// Let's say you have the following type ...\n//\n//--------------------------------------------------------------------------------------------\n\ntype T = {\n  id: string,\n  name: string,\n  timestamp: number\n}\n\n//--------------------------------------------------------------------------------------------\n//\n// ... you can express this type in the following way.\n//\n//--------------------------------------------------------------------------------------------\n\nconst T = Type.Object({                              // const T = {\n  id: Type.String(),                                 //   type: 'object',\n  name: Type.String(),                               //   properties: {\n  timestamp: Type.Integer()                          //     id: {\n})                                                   //       type: 'string'\n                                                     //     },\n                                                     //     name: {\n                                                     //       type: 'string'\n                                                     //     },\n                                                     //     timestamp: {\n                                                     //       type: 'integer'\n                                                     //     }\n                                                     //   },\n                                                     //   required: [\n                                                     //     'id',\n                                                     //     'name',\n                                                     //     'timestamp'\n                                                     //   ]\n                                                     // }\n\n//--------------------------------------------------------------------------------------------\n//\n// ... then infer back to the original static type this way.\n//\n//--------------------------------------------------------------------------------------------\n\ntype T = Static<typeof T>                            // type T = {\n                                                     //   id: string,\n                                                     //   name: string,\n                                                     //   timestamp: number\n                                                     // }\n\n//--------------------------------------------------------------------------------------------\n//\n// ... or use the type to parse JavaScript values.\n//\n//--------------------------------------------------------------------------------------------\n\nimport { Value } from '@sinclair/typebox/value'\n\nconst R = Value.Parse(T, value)                      // const R: {\n                                                     //   id: string,\n                                                     //   name: string,\n                                                     //   timestamp: number\n                                                     // }\n```\n\n<a name='types'></a>\n\n## Types\n\nTypeBox types are Json Schema fragments that compose into more complex types. Each fragment is structured such that any Json Schema compliant validator can runtime assert a value the same way TypeScript will statically assert a type. TypeBox offers a set of Json Types which are used to create Json Schema compliant schematics as well as a JavaScript type set used to create schematics for constructs native to JavaScript.\n\n<a name='types-json'></a>\n\n### Json Types\n\nThe following table lists the supported Json types. These types are fully compatible with the Json Schema Draft 7 specification.\n\n```typescript\n┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐\n│ TypeBox                        │ TypeScript                  │ Json Schema                    │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Any()           │ type T = any                │ const T = { }                  │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Unknown()       │ type T = unknown            │ const T = { }                  │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.String()        │ type T = string             │ const T = {                    │\n│                                │                             │   type: 'string'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Number()        │ type T = number             │ const T = {                    │\n│                                │                             │   type: 'number'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Integer()       │ type T = number             │ const T = {                    │\n│                                │                             │   type: 'integer'              │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Boolean()       │ type T = boolean            │ const T = {                    │\n│                                │                             │   type: 'boolean'              │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Null()          │ type T = null               │ const T = {                    │\n│                                │                             │   type: 'null'                 │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Literal(42)     │ type T = 42                 │ const T = {                    │\n│                                │                             │   const: 42,                   │\n│                                │                             │   type: 'number'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Array(          │ type T = number[]           │ const T = {                    │\n│   Type.Number()                │                             │   type: 'array',               │\n│ )                              │                             │   items: {                     │\n│                                │                             │     type: 'number'             │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Object({        │ type T = {                  │ const T = {                    │\n│   x: Type.Number(),            │   x: number,                │   type: 'object',              │\n│   y: Type.Number()             │   y: number                 │   required: ['x', 'y'],        │\n│ })                             │ }                           │   properties: {                │\n│                                │                             │     x: {                       │\n│                                │                             │       type: 'number'           │\n│                                │                             │     },                         │\n│                                │                             │     y: {                       │\n│                                │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Tuple([         │ type T = [number, number]   │ const T = {                    │\n│   Type.Number(),               │                             │   type: 'array',               │\n│   Type.Number()                │                             │   items: [{                    │\n│ ])                             │                             │     type: 'number'             │\n│                                │                             │   }, {                         │\n│                                │                             │     type: 'number'             │\n│                                │                             │   }],                          │\n│                                │                             │   additionalItems: false,      │\n│                                │                             │   minItems: 2,                 │\n│                                │                             │   maxItems: 2                  │\n│                                │                             │ }                              │\n│                                │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ enum Foo {                     │ enum Foo {                  │ const T = {                    │\n│   A,                           │   A,                        │   anyOf: [{                    │\n│   B                            │   B                         │     type: 'number',            │\n│ }                              │ }                           │     const: 0                   │\n│                                │                             │   }, {                         │\n│ const T = Type.Enum(Foo)       │ type T = Foo                │     type: 'number',            │\n│                                │                             │     const: 1                   │\n│                                │                             │   }]                           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Const({         │ type T = {                  │ const T = {                    │\n│   x: 1,                        │   readonly x: 1,            │   type: 'object',              │\n│   y: 2,                        │   readonly y: 2             │   required: ['x', 'y'],        │\n│ } as const)                    │ }                           │   properties: {                │\n│                                │                             │     x: {                       │\n│                                │                             │       type: 'number',          │\n│                                │                             │       const: 1                 │\n│                                │                             │     },                         │\n│                                │                             │     y: {                       │\n│                                │                             │       type: 'number',          │\n│                                │                             │       const: 2                 │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.KeyOf(          │ type T = keyof {            │ const T = {                    │\n│   Type.Object({                │   x: number,                │   anyOf: [{                    │\n│     x: Type.Number(),          │   y: number                 │     type: 'string',            │\n│     y: Type.Number()           │ }                           │     const: 'x'                 │\n│   })                           │                             │   }, {                         │\n│ )                              │                             │     type: 'string',            │\n│                                │                             │     const: 'y'                 │\n│                                │                             │   }]                           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Union([         │ type T = string | number    │ const T = {                    │\n│   Type.String(),               │                             │   anyOf: [{                    │\n│   Type.Number()                │                             │     type: 'string'             │\n│ ])                             │                             │   }, {                         │\n│                                │                             │     type: 'number'             │\n│                                │                             │   }]                           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Intersect([     │ type T = {                  │ const T = {                    │\n│   Type.Object({                │   x: number                 │   allOf: [{                    │\n│     x: Type.Number()           │ } & {                       │     type: 'object',            │\n│   }),                          │   y: number                 │     required: ['x'],           │\n│   Type.Object({                │ }                           │     properties: {              │\n│     y: Type.Number()           │                             │       x: {                     │\n│   })                           │                             │         type: 'number'         │\n│ ])                             │                             │       }                        │\n│                                │                             │     }                          │\n│                                │                             │   }, {                         │\n│                                │                             │     type: 'object',            |\n│                                │                             │     required: ['y'],           │\n│                                │                             │     properties: {              │\n│                                │                             │       y: {                     │\n│                                │                             │         type: 'number'         │\n│                                │                             │       }                        │\n│                                │                             │     }                          │\n│                                │                             │   }]                           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Composite([     │ type T = {                  │ const T = {                    │\n│   Type.Object({                │   x: number,                │   type: 'object',              │\n│     x: Type.Number()           │   y: number                 │   required: ['x', 'y'],        │\n│   }),                          │ }                           │   properties: {                │\n│   Type.Object({                │                             │     x: {                       │\n│     y: Type.Number()           │                             │       type: 'number'           │\n│   })                           │                             │     },                         │\n│ ])                             │                             │     y: {                       │\n│                                │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Never()         │ type T = never              │ const T = {                    │\n│                                │                             │   not: {}                      │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Not(            | type T = unknown            │ const T = {                    │\n│   Type.String()                │                             │   not: {                       │\n│ )                              │                             │     type: 'string'             │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Extends(        │ type T =                    │ const T = {                    │\n│   Type.String(),               │  string extends number      │   const: false,                │\n│   Type.Number(),               │    ? true                   │   type: 'boolean'              │\n│   Type.Literal(true),          │    : false                  │ }                              │\n│   Type.Literal(false)          │                             │                                │\n│ )                              │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Extract(        │ type T = Extract<           │ const T = {                    │\n│   Type.Union([                 │   string | number,          │   type: 'string'               │\n│     Type.String(),             │   string                    │ }                              │\n│     Type.Number(),             │ >                           │                                │\n│   ]),                          │                             │                                │\n│   Type.String()                │                             │                                │\n│ )                              │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Exclude(        │ type T = Exclude<           │ const T = {                    │\n│   Type.Union([                 │   string | number,          │   type: 'number'               │\n│     Type.String(),             │   string                    │ }                              │\n│     Type.Number(),             │ >                           │                                │\n│   ]),                          │                             │                                │\n│   Type.String()                │                             │                                │\n│ )                              │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Mapped(         │ type T = {                  │ const T = {                    │\n│   Type.Union([                 │   [_ in 'x' | 'y'] : number │   type: 'object',              │\n│     Type.Literal('x'),         │ }                           │   required: ['x', 'y'],        │\n│     Type.Literal('y')          │                             │   properties: {                │\n│   ]),                          │                             │     x: {                       │\n│   () => Type.Number()          │                             │       type: 'number'           │\n│ )                              │                             │     },                         │\n│                                │                             │     y: {                       │\n│                                │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const U = Type.Union([         │ type U = 'open' | 'close'   │ const T = {                    │\n│   Type.Literal('open'),        │                             │   type: 'string',              │\n│   Type.Literal('close')        │ type T = `on${U}`           │   pattern: '^on(open|close)$'  │\n│ ])                             │                             │ }                              │\n│                                │                             │                                │\n│ const T = Type                 │                             │                                │\n│   .TemplateLiteral([           │                             │                                │\n│      Type.Literal('on'),       │                             │                                │\n│      U                         │                             │                                │\n│   ])                           │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Record(         │ type T = Record<            │ const T = {                    │\n│   Type.String(),               │   string,                   │   type: 'object',              │\n│   Type.Number()                │   number                    │   patternProperties: {         │\n│ )                              │ >                           │     '^.*$': {                  │\n│                                │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Partial(        │ type T = Partial<{          │ const T = {                    │\n│   Type.Object({                │   x: number,                │   type: 'object',              │\n│     x: Type.Number(),          │   y: number                 │   properties: {                │\n│     y: Type.Number()           | }>                          │     x: {                       │\n│   })                           │                             │       type: 'number'           │\n│ )                              │                             │     },                         │\n│                                │                             │     y: {                       │\n│                                │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Required(       │ type T = Required<{         │ const T = {                    │\n│   Type.Object({                │   x?: number,               │   type: 'object',              │\n│     x: Type.Optional(          │   y?: number                │   required: ['x', 'y'],        │\n│       Type.Number()            | }>                          │   properties: {                │\n│     ),                         │                             │     x: {                       │\n│     y: Type.Optional(          │                             │       type: 'number'           │\n│       Type.Number()            │                             │     },                         │\n│     )                          │                             │     y: {                       │\n│   })                           │                             │       type: 'number'           │\n│ )                              │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Pick(           │ type T = Pick<{             │ const T = {                    │\n│   Type.Object({                │   x: number,                │   type: 'object',              │\n│     x: Type.Number(),          │   y: number                 │   required: ['x'],             │\n│     y: Type.Number()           │ }, 'x'>                     │   properties: {                │\n│   }), ['x']                    |                             │     x: {                       │\n│ )                              │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Omit(           │ type T = Omit<{             │ const T = {                    │\n│   Type.Object({                │   x: number,                │   type: 'object',              │\n│     x: Type.Number(),          │   y: number                 │   required: ['y'],             │\n│     y: Type.Number()           │ }, 'x'>                     │   properties: {                │\n│   }), ['x']                    |                             │     y: {                       │\n│ )                              │                             │       type: 'number'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Index(          │ type T = {                  │ const T = {                    │\n│   Type.Object({                │   x: number,                │   type: 'number'               │\n│     x: Type.Number(),          │   y: string                 │ }                              │\n│     y: Type.String()           │ }['x']                      │                                │\n│   }), ['x']                    │                             │                                │\n│ )                              │                             │                                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const A = Type.Tuple([         │ type A = [0, 1]             │ const T = {                    │\n│   Type.Literal(0),             │ type B = [2, 3]             │   type: 'array',               │\n│   Type.Literal(1)              │ type T = [                  │   items: [                     │\n│ ])                             │   ...A,                     │     { const: 0 },              │\n│ const B = Type.Tuple([         │   ...B                      │     { const: 1 },              │\n|   Type.Literal(2),             │ ]                           │     { const: 2 },              │\n|   Type.Literal(3)              │                             │     { const: 3 }               │\n│ ])                             │                             │   ],                           │\n│ const T = Type.Tuple([         │                             │   additionalItems: false,      │\n|   ...Type.Rest(A),             │                             │   minItems: 4,                 │\n|   ...Type.Rest(B)              │                             │   maxItems: 4                  │\n│ ])                             │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Uncapitalize(   │ type T = Uncapitalize<      │ const T = {                    │\n│   Type.Literal('Hello')        │   'Hello'                   │   type: 'string',              │\n│ )                              │ >                           │   const: 'hello'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Capitalize(     │ type T = Capitalize<        │ const T = {                    │\n│   Type.Literal('hello')        │   'hello'                   │   type: 'string',              │\n│ )                              │ >                           │   const: 'Hello'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Uppercase(      │ type T = Uppercase<         │ const T = {                    │\n│   Type.Literal('hello')        │   'hello'                   │   type: 'string',              │\n│ )                              │ >                           │   const: 'HELLO'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Lowercase(      │ type T = Lowercase<         │ const T = {                    │\n│   Type.Literal('HELLO')        │   'HELLO'                   │   type: 'string',              │\n│ )                              │ >                           │   const: 'hello'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const R = Type.Ref('T')        │ type R = unknown            │ const R = { $ref: 'T' }        │\n│                                │                             │                                │\n└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘\n```\n\n<a name='types-javascript'></a>\n\n### JavaScript Types\n\nTypeBox provides an extended type set that can be used to create schematics for common JavaScript constructs. These types can not be used with any standard Json Schema validator; but can be used to frame schematics for interfaces that may receive Json validated data. JavaScript types are prefixed with the `[JavaScript]` JSDoc comment for convenience. The following table lists the supported types.\n\n```typescript\n┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐\n│ TypeBox                        │ TypeScript                  │ Extended Schema                │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Constructor([   │ type T = new (              │ const T = {                    │\n│   Type.String(),               │  arg0: string,              │   type: 'Constructor',         │\n│   Type.Number()                │  arg0: number               │   parameters: [{               │\n│ ], Type.Boolean())             │ ) => boolean                │     type: 'string'             │\n│                                │                             │   }, {                         │\n│                                │                             │     type: 'number'             │\n│                                │                             │   }],                          │\n│                                │                             │   returns: {                   │\n│                                │                             │     type: 'boolean'            │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Function([      │ type T = (                  │ const T = {                    │\n|   Type.String(),               │  arg0: string,              │   type: 'Function',            │\n│   Type.Number()                │  arg1: number               │   parameters: [{               │\n│ ], Type.Boolean())             │ ) => boolean                │     type: 'string'             │\n│                                │                             │   }, {                         │\n│                                │                             │     type: 'number'             │\n│                                │                             │   }],                          │\n│                                │                             │   returns: {                   │\n│                                │                             │     type: 'boolean'            │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Promise(        │ type T = Promise<string>    │ const T = {                    │\n│   Type.String()                │                             │   type: 'Promise',             │\n│ )                              │                             │   item: {                      │\n│                                │                             │     type: 'string'             │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T =                      │ type T =                    │ const T = {                    │\n│   Type.AsyncIterator(          │   AsyncIterableIterator<    │   type: 'AsyncIterator',       │\n│     Type.String()              │    string                   │   items: {                     │\n│   )                            │   >                         │     type: 'string'             │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Iterator(       │ type T =                    │ const T = {                    │\n│   Type.String()                │   IterableIterator<string>  │   type: 'Iterator',            │\n│ )                              │                             │   items: {                     │\n│                                │                             │     type: 'string'             │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.RegExp(/abc/i)  │ type T = string             │ const T = {                    │\n│                                │                             │   type: 'RegExp'               │\n│                                │                             │   source: 'abc'                │\n│                                │                             │   flags: 'i'                   │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Uint8Array()    │ type T = Uint8Array         │ const T = {                    │\n│                                │                             │   type: 'Uint8Array'           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Date()          │ type T = Date               │ const T = {                    │\n│                                │                             │   type: 'Date'                 │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Undefined()     │ type T = undefined          │ const T = {                    │\n│                                │                             │   type: 'undefined'            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Symbol()        │ type T = symbol             │ const T = {                    │\n│                                │                             │   type: 'symbol'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.BigInt()        │ type T = bigint             │ const T = {                    │\n│                                │                             │   type: 'bigint'               │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Void()          │ type T = void               │ const T = {                    │\n│                                │                             │   type: 'void'                 │\n│                                │                             │ }                              │\n│                                │                             │                                │\n└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘\n```\n\n<a name='types-options'></a>\n\n### Options\n\nYou can pass Json Schema options on the last argument of any given type. Option hints specific to each type are provided for convenience.\n\n```typescript\n// String must be an email\nconst T = Type.String({                              // const T = {\n  format: 'email'                                    //   type: 'string',\n})                                                   //   format: 'email'\n                                                     // }\n\n// Number must be a multiple of 2\nconst T = Type.Number({                              // const T = {\n  multipleOf: 2                                      //  type: 'number',\n})                                                   //  multipleOf: 2\n                                                     // }\n\n// Array must have at least 5 integer values\nconst T = Type.Array(Type.Integer(), {               // const T = {\n  minItems: 5                                        //   type: 'array',\n})                                                   //   minItems: 5,\n                                                     //   items: {\n                                                     //     type: 'integer'\n                                                     //   }\n                                                     // }\n```\n\n<a name='types-properties'></a>\n\n### Properties\n\nObject properties can be modified with Readonly and Optional. The following table shows how these modifiers map between TypeScript and Json Schema.\n\n```typescript\n┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐\n│ TypeBox                        │ TypeScript                  │ Json Schema                    │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Object({        │ type T = {                  │ const T = {                    │\n│   name: Type.ReadonlyOptional( │   readonly name?: string    │   type: 'object',              │\n│     Type.String()              │ }                           │   properties: {                │\n│   )                            │                             │     name: {                    │\n│ })  \t                         │                             │       type: 'string'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Object({        │ type T = {                  │ const T = {                    │\n│   name: Type.Readonly(         │   readonly name: string     │   type: 'object',              │\n│     Type.String()              │ }                           │   properties: {                │\n│   )                            │                             │     name: {                    │\n│ })  \t                         │                             │       type: 'string'           │\n│                                │                             │     }                          │\n│                                │                             │   },                           │\n│                                │                             │   required: ['name']           │\n│                                │                             │ }                              │\n│                                │                             │                                │\n├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤\n│ const T = Type.Object({        │ type T = {                  │ const T = {                    │\n│   name: Type.Optional(         │   name?: string             │   type: 'object',              │\n│     Type.String()              │ }                           │   properties: {                │\n│   )                            │                             │     name: {                    │\n│ })  \t                         │                             │       type: 'string'           │\n│                                │                             │     }                          │\n│                                │                             │   }                            │\n│                                │                             │ }                              │\n│                                │                             │                                │\n└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘\n```\n\n<a name='types-generics'></a>\n\n### Generic Types\n\nGeneric types can be created with generic functions.\n\n```typescript\nconst Nullable = <T extends TSchema>(T: T) => {     // type Nullable<T> = T | null\n  return Type.Union([T, Type.Null()])\n}\n\nconst T = Nullable(Type.String())                  // type T = Nullable<string>\n```\n\n<a name='types-recursive'></a>\n\n### Recursive Types\n\nUse the Recursive function to create recursive types.\n\n```typescript\nconst Node = Type.Recursive(This => Type.Object({    // const Node = {\n  id: Type.String(),                                 //   $id: 'Node',\n  nodes: Type.Array(This)                            //   type: 'object',\n}), { $id: 'Node' })                                 //   properties: {\n                                                     //     id: {\n                                                     //       type: 'string'\n                                                     //     },\n                                                     //     nodes: {\n                                                     //       type: 'array',\n                                                     //       items: {\n                                                     //         $ref: 'Node'\n                                                     //       }\n                                                     //     }\n                                                     //   },\n                                                     //   required: [\n                                                     //     'id',\n                                                     //     'nodes'\n                                                     //   ]\n                                                     // }\n\ntype Node = Static<typeof Node>                      // type Node = {\n                                                     //   id: string\n                                                     //   nodes: Node[]\n                                                     // }\n\nfunction test(node: Node) {\n  const id = node.nodes[0].nodes[0].id               // id is string\n}\n```\n\n<a name='types-modules'></a>\n\n### Module Types\n\nModule types are containers for a set of referential types. Modules act as namespaces, enabling types to reference one another via string identifiers. Modules support both singular and mutually recursive references, as well as deferred dereferencing for computed types such as Partial. Types imported from a module are expressed using the Json Schema `$defs` keyword. \n\n```typescript\nconst Module = Type.Module({\n  PartialUser: Type.Partial(Type.Ref('User')),  // TComputed<'Partial', [TRef<'User'>]>\n\n  User: Type.Object({                           // TObject<{\n    id: Type.String(),                          //   user: TString,\n    name: Type.String(),                        //   name: TString,\n    email: Type.String()                        //   email: TString\n  }),                                           // }>\n})\nconst User = Module.Import('User')               // const User: TImport<{...}, 'User'>\n\ntype User = Static<typeof User>                  // type User = { \n                                                 //   id: string,\n                                                 //   name: string,\n                                                 //   email: string\n                                                 // }\n\nconst PartialUser = Module.Import('PartialUser') // const PartialUser: TImport<{...}, 'PartialUser'>\n\ntype PartialUser = Static<typeof PartialUser>    // type PartialUser = { \n                                                 //   id?: string,\n                                                 //   name?: string,\n                                                 //   email?: string\n                                                 // }\n```\n\n<a name='types-template-literal'></a>\n\n### Template Literal Types\n\nTypeBox supports template literal types with the TemplateLiteral function. This type can be created using a syntax similar to the TypeScript template literal syntax or composed from exterior types. TypeBox encodes template literals as regular expressions which enables the template to be checked by Json Schema validators. This type also supports regular expression parsing that enables template patterns to be used for generative types. The following shows both TypeScript and TypeBox usage.\n\n```typescript\n// TypeScript\n\ntype K = `prop${'A'|'B'|'C'}`                        // type T = 'propA' | 'propB' | 'propC'\n\ntype R = Record<K, string>                           // type R = {\n                                                     //   propA: string\n                                                     //   propB: string\n                                                     //   propC: string\n                                                     // }\n\n// TypeBox\n\nconst K = Type.TemplateLiteral('prop${A|B|C}')       // const K: TTemplateLiteral<[\n                                                     //   TLiteral<'prop'>,\n                                                     //   TUnion<[\n                                                     //      TLiteral<'A'>,\n                                                     //      TLiteral<'B'>,\n                                                     //      TLiteral<'C'>,\n                                                     //   ]>\n                                                     // ]>\n\nconst R = Type.Record(K, Type.String())              // const R: TObject<{\n                                                     //   propA: TString,\n                                                     //   propB: TString,\n                                                     //   propC: TString,\n                                                     // }>\n```\n\n<a name='types-indexed'></a>\n\n### Indexed Access Types\n\nTypeBox supports indexed access types with the Index function. This function enables uniform access to interior property and element types without having to extract them from the underlying schema representation. Index types are supported for Object, Array, Tuple, Union and Intersect types.\n\n```typescript\nconst T = Type.Object({                              // type T = {\n  x: Type.Number(),                                  //   x: number,\n  y: Type.String(),                                  //   y: string,\n  z: Type.Boolean()                                  //   z: boolean\n})                                                   // }\n\nconst A = Type.Index(T, ['x'])                       // type A = T['x']\n                                                     //\n                                                     // ... evaluated as\n                                                     //\n                                                     // const A: TNumber\n\nconst B = Type.Index(T, ['x', 'y'])                  // type B = T['x' | 'y']\n                                                     //\n                                                     // ... evaluated as\n                                                     //\n                                                     // const B: TUnion<[\n                                                     //   TNumber,\n                                                     //   TString,\n                                                     // ]>\n\nconst C = Type.Index(T, Type.KeyOf(T))               // type C = T[keyof T]\n                                                     //\n                                                     // ... evaluated as\n                                                     // \n                                                     // const C: TUnion<[\n                                                     //   TNumber,\n                                                     //   TString,\n                                                     //   TBoolean\n                                                     // ]>\n```\n\n<a name='types-mapped'></a>\n\n### Mapped Types\n\nTypeBox supports mapped types with the Mapped function. This function accepts two arguments, the first is a union type typically derived from KeyOf, the second is a mapping function that receives a mapping key `K` that can be used to index properties of a type. The following implements a mapped type that remaps each property to be `T | null`.\n\n```typescript\nconst T = Type.Object({                              // type T = {\n  x: Type.Number(),                                  //   x: number,\n  y: Type.String(),                                  //   y: string,\n  z: Type.Boolean()                                  //   z: boolean\n})                                                   // }\n\nconst M = Type.Mapped(Type.KeyOf(T), K => {          // type M = { [K in keyof T]: T[K] | null }\n  return Type.Union([Type.Index(T, K), Type.Null()]) //\n})                                                   // ... evaluated as\n                                                     // \n                                                     // const M: TObject<{\n                                                     //   x: TUnion<[TNumber, TNull]>,\n                                                     //   y: TUnion<[TString, TNull]>,\n                                                     //   z: TUnion<[TBoolean, TNull]>\n                                                     // }>\n```\n\n<a name='types-conditional'></a>\n\n### Conditional Types\n\nTypeBox supports runtime conditional types with the Extends function. This function performs a structural assignability check against the first (`left`) and second (`right`) arguments and will return either the third (`true`) or fourth (`false`) argument based on the result. The conditional types Exclude and Extract are also supported. The following shows both TypeScript and TypeBox examples of conditional types.\n\n```typescript\n// Extends\nconst A = Type.Extends(                              // type A = string extends number ? 1 : 2\n  Type.String(),                                     //   \n  Type.Number(),                                     // ... evaluated as\n  Type.Literal(1),                                   //\n  Type.Literal(2)                                    // const A: TLiteral<2>\n)\n\n// Extract\nconst B = Type.Extract(                              // type B = Extract<1 | 2 | 3, 1>\n  Type.Union([                                       //\n    Type.Literal(1),                                 // ... evaluated as\n    Type.Li","readmeFilename":"readme.md"}