Skip to content

Commit ab108ef

Browse files
committed
Documentation
1 parent e3edd3a commit ab108ef

9 files changed

Lines changed: 42 additions & 17 deletions

File tree

design/website/docs/compile/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ High Performance Runtime Validation
44

55
## Overview
66

7-
The Compile module is a high-performance JIT compiler that transforms types into efficient runtime validators. The compiler is optimized for both fast compilation and validation.
7+
The Compile submodule is a high-performance Json Schema compliant JIT compiler that compiles schematics into efficient runtime validators. The compiler is optimized for fast compilation and validation and is known to be one of the fastest validation solutions available for JavaScript.
88

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

design/website/docs/script/overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ TypeScript Scripting Engine
44

55
## Overview
66

7-
TypeBox includes a TypeScript scripting engine able to parse TypeScript types directly into Json Schema. The engine uses symmetric runtime and type-level parsing and returns typed safe schematics from TypeScript types (including computed types). The engine is designed for TypeScript 7 native compiler but is supported in TypeScript 5 and above.
7+
TypeBox is a runtime TypeScript DSL engine that can create, transform, and compute Json Schema using native TypeScript syntax. The engine is implemented symmetrically at runtime and within the TypeScript type system, and is intended for use with the TypeScript 7 native compiler and above.
8+
89

910
```typescript
1011
// Scripted Type

design/website/docs/type/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Json Schema Type Builder with Static Type Resolution for TypeScript
44

55
## Overview
66

7-
TypeBox includes many functions to create Json Schema types. Each function returns a small Json Schema fragment that corresponds to a TypeScript type. TypeBox uses function composition to combine schema fragments into more complex types. It provides a set of functions that are used to model Json Schema schematics as well as a set of functions that model constructs native to JavaScript and TypeScript.
7+
TypeBox provides many functions to create Json Schema types. Each function returns a small Json Schema fragment that can be composed into more complex types. TypeBox includes a set of functions that are used to construct Json Schema compliant schematics as well as a set of extended functions that return schematics for constructs native to JavaScript.
88

99
## Example
1010

design/website/docs/value/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Check and Parse JavaScript Values
44

55
## Overview
66

7-
The Value module provides functions that perform typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, Decode and as well as advanced functions to perform structural Diff and Patch on dynamic JavaScript values.
7+
The Value submodule provides functions for validation and other typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, and Decode, as well as advanced functions for performing structural Diff and Patch operations on dynamic JavaScript values.
88

99
```typescript
1010
import Value from 'typebox/value'

docs/docs/compile/overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>Compile</h1>
22
<p>High Performance Runtime Validation</p>
33
<h2>Overview</h2>
4-
<p>The Compile module is a high-performance JIT compiler that transforms types into efficient runtime validators. The compiler is optimized for both fast compilation and validation.</p>
4+
<p>The Compile submodule is a high-performance Json Schema compliant JIT compiler that compiles schematics into efficient runtime validators. The compiler is optimized for fast compilation and validation and is known to be one of the fastest validation solutions available for JavaScript.</p>
55
<pre><code class="language-typescript">import { Compile } from &#39;typebox/compile&#39;
66
</code></pre>
77
<h3>Example</h3>

docs/docs/script/overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>Script</h1>
22
<p>TypeScript Scripting Engine</p>
33
<h2>Overview</h2>
4-
<p>TypeBox includes a TypeScript scripting engine able to parse TypeScript types directly into Json Schema. The engine uses symmetric runtime and type-level parsing and returns typed safe schematics from TypeScript types (including computed types). The engine is designed for TypeScript 7 native compiler but is supported in TypeScript 5 and above.</p>
4+
<p>TypeBox is a runtime TypeScript DSL engine that can create, transform, and compute Json Schema using native TypeScript syntax. The engine is implemented symmetrically at runtime and within the TypeScript type system, and is intended for use with the TypeScript 7 native compiler and above.</p>
55
<pre><code class="language-typescript">// Scripted Type
66

77
const T = Type.Script(`{

docs/docs/type/overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>Type</h1>
22
<p>Json Schema Type Builder with Static Type Resolution for TypeScript</p>
33
<h2>Overview</h2>
4-
<p>TypeBox includes many functions to create Json Schema types. Each function returns a small Json Schema fragment that corresponds to a TypeScript type. TypeBox uses function composition to combine schema fragments into more complex types. It provides a set of functions that are used to model Json Schema schematics as well as a set of functions that model constructs native to JavaScript and TypeScript.</p>
4+
<p>TypeBox provides many functions to create Json Schema types. Each function returns a small Json Schema fragment that can be composed into more complex types. TypeBox includes a set of functions that are used to construct Json Schema compliant schematics as well as a set of extended functions that return schematics for constructs native to JavaScript.</p>
55
<h2>Example</h2>
66
<p>The following creates a Json Schema type and infers with Static.</p>
77
<pre><code class="language-typescript">import Type from &#39;typebox&#39;

docs/docs/value/overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>Value</h1>
22
<p>Check and Parse JavaScript Values</p>
33
<h2>Overview</h2>
4-
<p>The Value module provides functions that perform typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, Decode and as well as advanced functions to perform structural Diff and Patch on dynamic JavaScript values.</p>
4+
<p>The Value submodule provides functions for validation and other typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, and Decode, as well as advanced functions for performing structural Diff and Patch operations on dynamic JavaScript values.</p>
55
<pre><code class="language-typescript">import Value from &#39;typebox/value&#39;
66
</code></pre>
77
<h3>Example</h3>

readme.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ $ npm install typebox
2525

2626
## Usage
2727

28+
A TypeScript Engine for Json Schema [Reference](https://tsplay.dev/wQaoGw)
29+
2830
```typescript
2931
import Type from 'typebox'
3032

33+
// Json Schema Builder
34+
3135
const T = Type.Object({ // const T = {
3236
x: Type.Number(), // type: 'object',
3337
y: Type.Number(), // required: ['x', 'y', 'z'],
@@ -43,6 +47,26 @@ type T = Type.Static<typeof T> // type T = {
4347
// y: number,
4448
// z: number
4549
// }
50+
51+
// TypeScript Engine
52+
53+
const { S } = Type.Script({ T }, `
54+
type RenameKey<K> =
55+
K extends 'x' ? 'a' :
56+
K extends 'y' ? 'b' :
57+
K extends 'z' ? 'c' :
58+
K
59+
60+
type S = {
61+
readonly [K in keyof T as RenameKey<K>]: string
62+
}
63+
`)
64+
65+
type S = Type.Static<typeof S> // type S = {
66+
// readonly a: string,
67+
// readonly b: string,
68+
// readonly c: string
69+
// }
4670
```
4771
4872
## Overview
@@ -75,9 +99,9 @@ If upgrading from `@sinclair/typebox` refer to the 1.0 migration guide at the fo
7599
76100
## Type
77101
78-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/type/overview) | [Example](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgYwgDsBneBOAXkSIDoB5YgK1Q0YACgDecSVOkzZcuAHoFcOkxbs4YypLIAuTmi4A5AK4hiqKCICUAGnkPHspVMJp9eCAKEw8t7XBI+siGpuaWNvZO0Q4uklCoAI4mwAkAJvoA2ngU9nhIfvgAXngAuv6SRcHcYRZW1jGNcnFwYNhosMCojPpaAL4NTUPDisrSeppwbqge9GZ1eHB9FSOrjS2SQZPTs-OWi8sBa8exY1JV20S74VAHRycP0i1994+PLi+U04gaIahcAGUYABDGDAGgAHmmEAwiAAfCcXN9WBwtG90aMpBM5jcVhiHi0tji6nj8ccWhdiZZXmSRh8gA)
102+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/type/overview) | [Example](https://tsplay.dev/NaMoBN)
79103
80-
TypeBox includes many functions to create Json Schema types. Each function returns a small Json Schema fragment that corresponds to a TypeScript type. TypeBox uses function composition to combine schema fragments into more complex types. It provides a set of functions that are used to model Json Schema schematics as well as a set of functions that model constructs native to JavaScript and TypeScript.
104+
TypeBox provides many functions to create Json Schema types. Each function returns a small Json Schema fragment that can be composed into more complex types. TypeBox includes a set of functions that are used to construct Json Schema compliant schematics as well as a set of extended functions that return schematics for constructs native to JavaScript.
81105
82106
## Example
83107
@@ -123,9 +147,9 @@ const S = Type.Number({ // const S = {
123147

124148
## Value
125149

126-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/value/overview) | [Example](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBANQIYBsCuBTOAzKERwDkMAnmBgEYQAeA9AG6qaEBQokscAKmVrvkVLkq1ViwDGEAHYBneFzgBebrwB0AeQoArDOJgAKAN4s4cagC4V5VQDk0IChij6AlABoTcEpZ7W7Dp1cPUwAvHzV-R2cXFgBfGIlpOTgAQSVEJgxVAAUkKBkMfS43OENTcorKqqraWjhJWXgUy2NTCzgARhLqnt6+vtry9ql7KOCvSwAGbv7ZuerB0284EYCocbC4Sfmd3bhFuE3VqLiXPfOdwdj01VugA)
150+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/value/overview) | [Example](https://tsplay.dev/W4YE1w)
127151

128-
The Value module provides functions that perform typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, Decode and as well as advanced functions to perform structural Diff and Patch on dynamic JavaScript values.
152+
The Value submodule provides functions for validation and other typed operations on JavaScript values. It includes functions such as Check, Parse, Clone, Encode, and Decode, as well as advanced functions for performing structural Diff and Patch operations on dynamic JavaScript values.
129153

130154
```typescript
131155
import Value from 'typebox/value'
@@ -154,9 +178,9 @@ const A = Value.Parse(T, { // const A: {
154178

155179
## Compile
156180

157-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/compile/overview) | [Example](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQuYAbApnAvnAMyjTgHIYBPMLAIwgA8B6AYzTEy1IChRJY4AKlRxES5YXXrcurAHYBneMjgBeFGw4AKIdQB0AeRoArLMxiakcK9Zu3bjRnDmKUALjgA1AIYZgAEy8YaAAeBFwAGkFDEzNQrit6dx0sXQA5AFcQGiwoTQBKSLsi4pKrB2tEwQysnPD4uAok4TTM7NyC0s6u8qtGqtba+oAvJr1qtvyuqZKeuBH+mqguXDy86fWNm3LcAD4drhkIBXgAQVUUXQAFLyh5LAtNjfLnU-cEesqABkLH37tZyqyAZQOq9dwARh+f2hcFmfSBi1Bc3cnxhaNhjis8wRbWWa3RBO2510JKAA)
181+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/compile/overview) | [Example](https://tsplay.dev/WyraZw)
158182

159-
The Compile module is a high-performance JIT compiler that transforms types into efficient runtime validators. The compiler is optimized for both fast compilation and validation.
183+
The Compile submodule is a high-performance Json Schema compliant JIT compiler that compiles schematics into efficient runtime validators. The compiler is optimized for fast compilation and validation and is known to be one of the fastest validation solutions available for JavaScript.
160184

161185
```typescript
162186
import { Compile } from 'typebox/compile'
@@ -182,9 +206,9 @@ const A = C.Parse({ // const A: {
182206

183207
## Script
184208

185-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgGUBjKYMGVAE0SOqYgB2AZ3gI4AXh5oAdM1bsAFAAMA3nEpw4ZAFxwBAVxDFUUADTrNSXSNYCA5uY1wAXrtIQANqgCGA9QF8lAEpNULDwiMio6PC6OH5hUV0EAHliACtUJhgAHhUnGMKi4rC4zR1EADlDYzMCkobG0vpLZIYYWwd6pp7ispdkgCEITx8Bbt7JqLj-AD5qOIApIUFGJgALVBBvOABJAQ6IITRs4EFqBGlCNCnb0Li8CAysmCpLqFQAR31gD+47npxADaeAo5jwSDw4OceAAupRLmBsGhYMBUEIAY04moKtI8eYrHA8dJzK4iXi4P4FvQ5GwONxkDcFABhHBgfT0oJ8QQiRgSKSoWQsOkKNRifzmVROIEAaTgwD8AGtUEgIBhELDkrLYXAAD56fQeDyUQIhTF3OIJXkMZJpTLZPITc2TfoVBAAVQEZwEOSBCGqRhM5n9ho8sNmpidzsBLTghI9XsEvoQ7U6weqRvDkejAP6ZIT3uTw1GvnTofDUZzDRm81oNJgvk43ig3H2GBMqAETFQ1Gu6AY-MZgva3hgwCYOT7asYs1ucT7fMk+Src9jFQMgageoNRuzK5dscJNgVdm3Bl3lf3hTzbhGXl8Z9Dl6v0RmQA) | [Example 2](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgAkIA3VKOGAC1QGd0NocYADsMbVMIDG6ABQ9OEAK4AbACZwQAQxiTOHbnB6SowMDFTrCaAJSVUZSLA5E4AMQgQ4AXkREAdADKMNrAkgA8VqgQGG4eAHx2DtDwkXAAQprsPshogcEwoRFE0emZCbT0AMIQYEhwmsLqYJo85ogBzmg8QsIwnjmogcamMDJ+49b1jXAA5qjwxJqSANadqAC0PJpicABSAQDyAHJwAbqoWomO8JIQwq1wAN6xEAA0pewAvt6+uWcmZhkAANKKl3J4fI9KHA4GQAFxwYSKEDENjQuBIBFIlFomEALyxyNRUEon2oqQyWSe6KgqE0qjuyjqAG0ANI9ODLVBIErg+rdACymjAYVZcQAugiAIKqZgNaSqUVxOAAHxebPFpPJLhlcqkFlF3PeADVMsAGjBuj48AANPCq-AATXtarwAC08MqfDJ0QAdIG+gAkjwAqmA0FBJC1UIakHFPkHHqaTBaeJ91qBIDweMBiMpUP7KLZQS4hSLWdyvXAwxGo3wwuiK3V7OZGt08BQ4AB+fCae1wxvcuAtiSqdtIe09vDEfuD5tkVtj-B4yf4SSzmHCVCsEnlIG2OhwA6KGBgE9rbqZfgqJlwWkYfOSYJ59D7Y6nc6XcF+VIwv---9DzwCBiAAK1QJ97TgShvzAbAIwKXgAL-Q9nnhOBxj8d5MQw8Z3gJXC-DgMlv1pABHRRgFpdRkJQ+hmQ7PB3jwCdmJXcUgA)
209+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://tsplay.dev/Wk6L1m) | [Example 2](https://tsplay.dev/NnrJoN)
186210

187-
TypeBox includes a TypeScript scripting engine able to parse TypeScript types directly into Json Schema. The engine uses symmetric runtime and type-level parsing and returns typed safe schematics from TypeScript types (including computed types). The engine is designed for TypeScript 7 native compiler but is supported in TypeScript 5 and above.
211+
TypeBox is a runtime TypeScript DSL engine that can create, transform, and compute Json Schema using native TypeScript syntax. The engine is implemented symmetrically at runtime and within the TypeScript type system, and is intended for use with the TypeScript 7 native compiler and above.
188212

189213
```typescript
190214
// Scripted Type
@@ -228,7 +252,7 @@ type S = Type.Static<typeof S> // type S = {
228252
229253
## Schema
230254
231-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQuYAbApnAvnAMyjTgHIYBPMLAIwgA8B6AYzTEy1ICgfWA7AM7xkcALwo2HABQIucOJWoAuMhBoArLMxikANHLhQsARwCuwIwBMVAbVL09ZCo9IAvUgF198sMWqxgLAEVWXl5ehCFKiwVUj5TEBosKFI8bzCKSMUYsnjE5NTcdPlXLOjYvKSUvANcLlwASl4IQXgAQTEUADoABQBDKAEsGTDRsfGJycZGOH4hODaQgwi4AAZdSc2t7YnpsJXK5PTMtY2d84uxvfkTw6h00rgARkvXy+u4R7v6hre-95m+HEXRBQA) | [Example 2](https://tsplay.dev/mxrl7w)
255+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://tsplay.dev/Wvrv3W) | [Example 2](https://tsplay.dev/m3g0ym)
232256
233257
TypeBox is built upon a high-performance validation infrastructure that supports the direct compilation and inference of Json Schema schematics. TypeBox implements Draft 3 to 2020-12 and is compliance tested via the official Json Schema [Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite). It offers high-performance JIT compilation with automatic fallback to dynamic checking in JIT restricted environments.
234258

0 commit comments

Comments
 (0)