@sinclair/typebox 0.34.27 → 0.34.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,42 +16,23 @@ type SemiColon = ';';
16
16
  type SingleQuote = "'";
17
17
  type DoubleQuote = '"';
18
18
  type Tilde = '`';
19
- interface DelimitTailMapping<_ = unknown> extends Static.IMapping {
20
- output: (this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer I, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, I, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer Rest extends unknown[]] ? [A, B, C, D, E, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer Rest extends unknown[]] ? [A, B, C, D, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer Rest extends unknown[]] ? [A, B, C, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer Rest extends unknown[]] ? [A, B, ...Rest] : this['input'] extends [_, infer A, _, infer Rest extends unknown[]] ? [A, ...Rest] : this['input'] extends [_, infer Rest extends unknown[]] ? [...Rest] : this['input'] extends [_] ? [] : [
21
- ]);
19
+ type DelimitHeadReduce<Elements extends unknown[], Result extends unknown[] = []> = (Elements extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends [infer Element, infer _Delimiter] ? DelimitHeadReduce<Right, [...Result, Element]> : DelimitHeadReduce<Right, Result> : Result);
20
+ interface DelimitHeadMapping extends Static.IMapping {
21
+ output: this['input'] extends unknown[] ? DelimitHeadReduce<this['input']> : [];
22
22
  }
23
- type DelimitTail<T extends Static.IParser, _ extends Static.IParser> = Static.Union<[
24
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
25
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
26
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
27
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
28
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
29
- Static.Tuple<[_, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
30
- Static.Tuple<[_, T, _, T, _, T, _, Delimit<T, _>]>,
31
- Static.Tuple<[_, T, _, T, _, Delimit<T, _>]>,
32
- Static.Tuple<[_, T, _, Delimit<T, _>]>,
33
- Static.Tuple<[_, Delimit<T, _>]>,
34
- Static.Tuple<[_]>,
23
+ type DelimitHead<Element extends Static.IParser, Delimiter extends Static.IParser> = (Static.Array<Static.Tuple<[Element, Delimiter]>, DelimitHeadMapping>);
24
+ type DelimitTail<Element extends Static.IParser> = Static.Union<[
25
+ Static.Tuple<[Element]>,
35
26
  Static.Tuple<[]>
36
- ], DelimitTailMapping>;
27
+ ]>;
37
28
  interface DelimitMapping extends Static.IMapping {
38
- output: (this['input'] extends [infer Element extends unknown, infer Rest extends unknown[]] ? [Element, ...Rest] : []);
29
+ output: this['input'] extends [infer Left extends unknown[], infer Right extends unknown[]] ? [...Left, ...Right] : [];
39
30
  }
40
- type Delimit<Parser extends Static.IParser, Delimiter extends Static.IParser> = (Static.Union<[
41
- Static.Tuple<[Parser, DelimitTail<Parser, Delimiter>]>,
42
- Static.Tuple<[]>
43
- ], DelimitMapping>);
31
+ type Delimit<Element extends Static.IParser, Delimiter extends Static.IParser> = Static.Tuple<[
32
+ DelimitHead<Element, Delimiter>,
33
+ DelimitTail<Element>
34
+ ], DelimitMapping>;
44
35
  type Dereference<Context extends t.TProperties, Ref extends string> = (Ref extends keyof Context ? Context[Ref] : t.TRef<Ref>);
45
- interface GenericArgumentListMapping extends Static.IMapping {
46
- output: (this['input'] extends [infer Ident extends string, Comma, infer Rest extends unknown[]] ? [Ident, ...Rest] : this['input'] extends [infer Ident extends string, Comma] ? [Ident] : this['input'] extends [infer Ident extends string] ? [Ident] : [
47
- ]);
48
- }
49
- type GenericArgumentList = Static.Union<[
50
- Static.Tuple<[Static.Ident, Static.Const<Comma>, GenericArgumentList]>,
51
- Static.Tuple<[Static.Ident, Static.Const<Comma>]>,
52
- Static.Tuple<[Static.Ident]>,
53
- Static.Tuple<[]>
54
- ], GenericArgumentListMapping>;
55
36
  type GenericArgumentsContext<Args extends string[], Context extends t.TProperties, Result extends t.TProperties = {}> = (Args extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext<Left, Context, Result & {
56
37
  [_ in Right]: t.TArgument<Left['length']>;
57
38
  }> : t.Evaluate<Result & Context>);
@@ -60,7 +41,7 @@ interface GenericArgumentsMapping extends Static.IMapping {
60
41
  }
61
42
  type GenericArguments = Static.Tuple<[
62
43
  Static.Const<LAngle>,
63
- GenericArgumentList,
44
+ Delimit<Static.Ident, Static.Const<Comma>>,
64
45
  Static.Const<RAngle>
65
46
  ], GenericArgumentsMapping>;
66
47
  interface GenericReferenceMapping extends Static.IMapping {
@@ -243,7 +224,7 @@ type PropertyDelimiter = Static.Union<[
243
224
  Static.Tuple<[Static.Const<SemiColon>]>,
244
225
  Static.Tuple<[Static.Const<Newline>]>
245
226
  ]>;
246
- type PropertiesReduce<PropertiesArray extends t.TProperties[], Result extends t.TProperties = {}> = (PropertiesArray extends [infer Left extends t.TProperties, ...infer Right extends t.TProperties[]] ? PropertiesReduce<Right, t.Evaluate<Result & Left>> : Result);
227
+ type PropertiesReduce<PropertiesArray extends t.TProperties[], Result extends t.TProperties = {}> = (PropertiesArray extends [infer Left extends t.TProperties, ...infer Right extends t.TProperties[]] ? PropertiesReduce<Right, Result & Left> : t.Evaluate<Result>);
247
228
  interface PropertiesMapping extends Static.IMapping {
248
229
  output: this['input'] extends t.TProperties[] ? PropertiesReduce<this['input']> : never;
249
230
  }
@@ -4,7 +4,7 @@ import { StaticDecode } from '../../type/static/index';
4
4
  export declare class ParseError extends TypeBoxError {
5
5
  constructor(message: string);
6
6
  }
7
- export type TParseOperation = 'Clone' | 'Clean' | 'Default' | 'Convert' | 'Assert' | 'Decode' | 'Encode' | ({} & string);
7
+ export type TParseOperation = 'Assert' | 'Cast' | 'Clean' | 'Clone' | 'Convert' | 'Decode' | 'Default' | 'Encode' | ({} & string);
8
8
  export type TParseFunction = (type: TSchema, references: TSchema[], value: unknown) => unknown;
9
9
  export declare namespace ParseRegistry {
10
10
  function Delete(key: string): void;
@@ -6,14 +6,15 @@ exports.Parse = Parse;
6
6
  const index_1 = require("../../type/error/index");
7
7
  const index_2 = require("../transform/index");
8
8
  const index_3 = require("../assert/index");
9
- const index_4 = require("../default/index");
10
- const index_5 = require("../convert/index");
11
- const index_6 = require("../clean/index");
12
- const index_7 = require("../clone/index");
9
+ const index_4 = require("../cast/index");
10
+ const index_5 = require("../clean/index");
11
+ const index_6 = require("../clone/index");
12
+ const index_7 = require("../convert/index");
13
+ const index_8 = require("../default/index");
13
14
  // ------------------------------------------------------------------
14
15
  // Guards
15
16
  // ------------------------------------------------------------------
16
- const index_8 = require("../guard/index");
17
+ const index_9 = require("../guard/index");
17
18
  // ------------------------------------------------------------------
18
19
  // Error
19
20
  // ------------------------------------------------------------------
@@ -27,12 +28,13 @@ exports.ParseError = ParseError;
27
28
  var ParseRegistry;
28
29
  (function (ParseRegistry) {
29
30
  const registry = new Map([
30
- ['Clone', (_type, _references, value) => (0, index_7.Clone)(value)],
31
- ['Clean', (type, references, value) => (0, index_6.Clean)(type, references, value)],
32
- ['Default', (type, references, value) => (0, index_4.Default)(type, references, value)],
33
- ['Convert', (type, references, value) => (0, index_5.Convert)(type, references, value)],
34
31
  ['Assert', (type, references, value) => { (0, index_3.Assert)(type, references, value); return value; }],
32
+ ['Cast', (type, references, value) => (0, index_4.Cast)(type, references, value)],
33
+ ['Clean', (type, references, value) => (0, index_5.Clean)(type, references, value)],
34
+ ['Clone', (_type, _references, value) => (0, index_6.Clone)(value)],
35
+ ['Convert', (type, references, value) => (0, index_7.Convert)(type, references, value)],
35
36
  ['Decode', (type, references, value) => ((0, index_2.HasTransform)(type, references) ? (0, index_2.TransformDecode)(type, references, value) : value)],
37
+ ['Default', (type, references, value) => (0, index_8.Default)(type, references, value)],
36
38
  ['Encode', (type, references, value) => ((0, index_2.HasTransform)(type, references) ? (0, index_2.TransformEncode)(type, references, value) : value)],
37
39
  ]);
38
40
  // Deletes an entry from the registry
@@ -52,7 +54,7 @@ var ParseRegistry;
52
54
  ParseRegistry.Get = Get;
53
55
  })(ParseRegistry || (exports.ParseRegistry = ParseRegistry = {}));
54
56
  // ------------------------------------------------------------------
55
- // Default Parse Sequence
57
+ // Default Parse Pipeline
56
58
  // ------------------------------------------------------------------
57
59
  // prettier-ignore
58
60
  exports.ParseDefault = [
@@ -69,7 +71,7 @@ exports.ParseDefault = [
69
71
  function ParseValue(operations, type, references, value) {
70
72
  return operations.reduce((value, operationKey) => {
71
73
  const operation = ParseRegistry.Get(operationKey);
72
- if ((0, index_8.IsUndefined)(operation))
74
+ if ((0, index_9.IsUndefined)(operation))
73
75
  throw new ParseError(`Unable to find Parse operation '${operationKey}'`);
74
76
  return operation(type, references, value);
75
77
  }, value);
@@ -78,7 +80,7 @@ function ParseValue(operations, type, references, value) {
78
80
  function Parse(...args) {
79
81
  // prettier-ignore
80
82
  const [operations, schema, references, value] = (args.length === 4 ? [args[0], args[1], args[2], args[3]] :
81
- args.length === 3 ? (0, index_8.IsArray)(args[0]) ? [args[0], args[1], [], args[2]] : [exports.ParseDefault, args[0], args[1], args[2]] :
83
+ args.length === 3 ? (0, index_9.IsArray)(args[0]) ? [args[0], args[1], [], args[2]] : [exports.ParseDefault, args[0], args[1], args[2]] :
82
84
  args.length === 2 ? [exports.ParseDefault, args[0], [], args[1]] :
83
85
  (() => { throw new ParseError('Invalid Arguments'); })());
84
86
  return ParseValue(operations, schema, references, value);
@@ -16,42 +16,23 @@ type SemiColon = ';';
16
16
  type SingleQuote = "'";
17
17
  type DoubleQuote = '"';
18
18
  type Tilde = '`';
19
- interface DelimitTailMapping<_ = unknown> extends Static.IMapping {
20
- output: (this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer I, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, I, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer H, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, H, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer G, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, G, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer F, _, infer Rest extends unknown[]] ? [A, B, C, D, E, F, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer E, _, infer Rest extends unknown[]] ? [A, B, C, D, E, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer D, _, infer Rest extends unknown[]] ? [A, B, C, D, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer C, _, infer Rest extends unknown[]] ? [A, B, C, ...Rest] : this['input'] extends [_, infer A, _, infer B, _, infer Rest extends unknown[]] ? [A, B, ...Rest] : this['input'] extends [_, infer A, _, infer Rest extends unknown[]] ? [A, ...Rest] : this['input'] extends [_, infer Rest extends unknown[]] ? [...Rest] : this['input'] extends [_] ? [] : [
21
- ]);
19
+ type DelimitHeadReduce<Elements extends unknown[], Result extends unknown[] = []> = (Elements extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends [infer Element, infer _Delimiter] ? DelimitHeadReduce<Right, [...Result, Element]> : DelimitHeadReduce<Right, Result> : Result);
20
+ interface DelimitHeadMapping extends Static.IMapping {
21
+ output: this['input'] extends unknown[] ? DelimitHeadReduce<this['input']> : [];
22
22
  }
23
- type DelimitTail<T extends Static.IParser, _ extends Static.IParser> = Static.Union<[
24
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
25
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
26
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
27
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
28
- Static.Tuple<[_, T, _, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
29
- Static.Tuple<[_, T, _, T, _, T, _, T, _, Delimit<T, _>]>,
30
- Static.Tuple<[_, T, _, T, _, T, _, Delimit<T, _>]>,
31
- Static.Tuple<[_, T, _, T, _, Delimit<T, _>]>,
32
- Static.Tuple<[_, T, _, Delimit<T, _>]>,
33
- Static.Tuple<[_, Delimit<T, _>]>,
34
- Static.Tuple<[_]>,
23
+ type DelimitHead<Element extends Static.IParser, Delimiter extends Static.IParser> = (Static.Array<Static.Tuple<[Element, Delimiter]>, DelimitHeadMapping>);
24
+ type DelimitTail<Element extends Static.IParser> = Static.Union<[
25
+ Static.Tuple<[Element]>,
35
26
  Static.Tuple<[]>
36
- ], DelimitTailMapping>;
27
+ ]>;
37
28
  interface DelimitMapping extends Static.IMapping {
38
- output: (this['input'] extends [infer Element extends unknown, infer Rest extends unknown[]] ? [Element, ...Rest] : []);
29
+ output: this['input'] extends [infer Left extends unknown[], infer Right extends unknown[]] ? [...Left, ...Right] : [];
39
30
  }
40
- type Delimit<Parser extends Static.IParser, Delimiter extends Static.IParser> = (Static.Union<[
41
- Static.Tuple<[Parser, DelimitTail<Parser, Delimiter>]>,
42
- Static.Tuple<[]>
43
- ], DelimitMapping>);
31
+ type Delimit<Element extends Static.IParser, Delimiter extends Static.IParser> = Static.Tuple<[
32
+ DelimitHead<Element, Delimiter>,
33
+ DelimitTail<Element>
34
+ ], DelimitMapping>;
44
35
  type Dereference<Context extends t.TProperties, Ref extends string> = (Ref extends keyof Context ? Context[Ref] : t.TRef<Ref>);
45
- interface GenericArgumentListMapping extends Static.IMapping {
46
- output: (this['input'] extends [infer Ident extends string, Comma, infer Rest extends unknown[]] ? [Ident, ...Rest] : this['input'] extends [infer Ident extends string, Comma] ? [Ident] : this['input'] extends [infer Ident extends string] ? [Ident] : [
47
- ]);
48
- }
49
- type GenericArgumentList = Static.Union<[
50
- Static.Tuple<[Static.Ident, Static.Const<Comma>, GenericArgumentList]>,
51
- Static.Tuple<[Static.Ident, Static.Const<Comma>]>,
52
- Static.Tuple<[Static.Ident]>,
53
- Static.Tuple<[]>
54
- ], GenericArgumentListMapping>;
55
36
  type GenericArgumentsContext<Args extends string[], Context extends t.TProperties, Result extends t.TProperties = {}> = (Args extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext<Left, Context, Result & {
56
37
  [_ in Right]: t.TArgument<Left['length']>;
57
38
  }> : t.Evaluate<Result & Context>);
@@ -60,7 +41,7 @@ interface GenericArgumentsMapping extends Static.IMapping {
60
41
  }
61
42
  type GenericArguments = Static.Tuple<[
62
43
  Static.Const<LAngle>,
63
- GenericArgumentList,
44
+ Delimit<Static.Ident, Static.Const<Comma>>,
64
45
  Static.Const<RAngle>
65
46
  ], GenericArgumentsMapping>;
66
47
  interface GenericReferenceMapping extends Static.IMapping {
@@ -243,7 +224,7 @@ type PropertyDelimiter = Static.Union<[
243
224
  Static.Tuple<[Static.Const<SemiColon>]>,
244
225
  Static.Tuple<[Static.Const<Newline>]>
245
226
  ]>;
246
- type PropertiesReduce<PropertiesArray extends t.TProperties[], Result extends t.TProperties = {}> = (PropertiesArray extends [infer Left extends t.TProperties, ...infer Right extends t.TProperties[]] ? PropertiesReduce<Right, t.Evaluate<Result & Left>> : Result);
227
+ type PropertiesReduce<PropertiesArray extends t.TProperties[], Result extends t.TProperties = {}> = (PropertiesArray extends [infer Left extends t.TProperties, ...infer Right extends t.TProperties[]] ? PropertiesReduce<Right, Result & Left> : t.Evaluate<Result>);
247
228
  interface PropertiesMapping extends Static.IMapping {
248
229
  output: this['input'] extends t.TProperties[] ? PropertiesReduce<this['input']> : never;
249
230
  }
@@ -4,7 +4,7 @@ import { StaticDecode } from '../../type/static/index.mjs';
4
4
  export declare class ParseError extends TypeBoxError {
5
5
  constructor(message: string);
6
6
  }
7
- export type TParseOperation = 'Clone' | 'Clean' | 'Default' | 'Convert' | 'Assert' | 'Decode' | 'Encode' | ({} & string);
7
+ export type TParseOperation = 'Assert' | 'Cast' | 'Clean' | 'Clone' | 'Convert' | 'Decode' | 'Default' | 'Encode' | ({} & string);
8
8
  export type TParseFunction = (type: TSchema, references: TSchema[], value: unknown) => unknown;
9
9
  export declare namespace ParseRegistry {
10
10
  function Delete(key: string): void;
@@ -1,10 +1,11 @@
1
1
  import { TypeBoxError } from '../../type/error/index.mjs';
2
2
  import { TransformDecode, TransformEncode, HasTransform } from '../transform/index.mjs';
3
3
  import { Assert } from '../assert/index.mjs';
4
- import { Default } from '../default/index.mjs';
5
- import { Convert } from '../convert/index.mjs';
4
+ import { Cast } from '../cast/index.mjs';
6
5
  import { Clean } from '../clean/index.mjs';
7
6
  import { Clone } from '../clone/index.mjs';
7
+ import { Convert } from '../convert/index.mjs';
8
+ import { Default } from '../default/index.mjs';
8
9
  // ------------------------------------------------------------------
9
10
  // Guards
10
11
  // ------------------------------------------------------------------
@@ -21,12 +22,13 @@ export class ParseError extends TypeBoxError {
21
22
  export var ParseRegistry;
22
23
  (function (ParseRegistry) {
23
24
  const registry = new Map([
24
- ['Clone', (_type, _references, value) => Clone(value)],
25
+ ['Assert', (type, references, value) => { Assert(type, references, value); return value; }],
26
+ ['Cast', (type, references, value) => Cast(type, references, value)],
25
27
  ['Clean', (type, references, value) => Clean(type, references, value)],
26
- ['Default', (type, references, value) => Default(type, references, value)],
28
+ ['Clone', (_type, _references, value) => Clone(value)],
27
29
  ['Convert', (type, references, value) => Convert(type, references, value)],
28
- ['Assert', (type, references, value) => { Assert(type, references, value); return value; }],
29
30
  ['Decode', (type, references, value) => (HasTransform(type, references) ? TransformDecode(type, references, value) : value)],
31
+ ['Default', (type, references, value) => Default(type, references, value)],
30
32
  ['Encode', (type, references, value) => (HasTransform(type, references) ? TransformEncode(type, references, value) : value)],
31
33
  ]);
32
34
  // Deletes an entry from the registry
@@ -46,7 +48,7 @@ export var ParseRegistry;
46
48
  ParseRegistry.Get = Get;
47
49
  })(ParseRegistry || (ParseRegistry = {}));
48
50
  // ------------------------------------------------------------------
49
- // Default Parse Sequence
51
+ // Default Parse Pipeline
50
52
  // ------------------------------------------------------------------
51
53
  // prettier-ignore
52
54
  export const ParseDefault = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.34.27",
3
+ "version": "0.34.29",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
package/readme.md CHANGED
@@ -544,7 +544,7 @@ The following table lists the supported Json types. These types are fully compat
544
544
 
545
545
  ### JavaScript Types
546
546
 
547
- TypeBox 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.
547
+ TypeBox 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.
548
548
 
549
549
  ```typescript
550
550
  ┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐
@@ -717,11 +717,11 @@ Object properties can be modified with Readonly and Optional. The following tabl
717
717
 
718
718
  ### Generic Types
719
719
 
720
- Generic types can be created with generic functions
720
+ Generic types can be created with generic functions.
721
721
 
722
722
  ```typescript
723
723
  const Nullable = <T extends TSchema>(T: T) => { // type Nullable<T> = T | null
724
- return Type.Union([T, Type.Null())
724
+ return Type.Union([T, Type.Null()])
725
725
  }
726
726
 
727
727
  const T = Nullable(Type.String()) // type T = Nullable<string>
@@ -731,7 +731,7 @@ const T = Nullable(Type.String()) // type T = Nullable<string>
731
731
 
732
732
  ### Recursive Types
733
733
 
734
- Use the Recursive function to create recursive types
734
+ Use the Recursive function to create recursive types.
735
735
 
736
736
  ```typescript
737
737
  const Node = Type.Recursive(This => Type.Object({ // const Node = {
@@ -875,7 +875,7 @@ const C = Type.Index(T, Type.KeyOf(T)) // type C = T[keyof T]
875
875
 
876
876
  ### Mapped Types
877
877
 
878
- TypeBox 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`
878
+ TypeBox 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`.
879
879
 
880
880
  ```typescript
881
881
  const T = Type.Object({ // type T = {
@@ -1123,7 +1123,7 @@ const Z = Value.Default(T, { x: 1 }) // const 'Z = { x: 1, y:
1123
1123
 
1124
1124
  ### Cast
1125
1125
 
1126
- Use the Cast function to upcast a value into a target type. This function will retain as much infomation as possible from the original value. The Cast function is intended to be used in data migration scenarios where existing values need to be upgraded to match a modified type.
1126
+ Use the Cast function to upcast a value into a target type. This function will retain as much information as possible from the original value. The Cast function is intended to be used in data migration scenarios where existing values need to be upgraded to match a modified type.
1127
1127
 
1128
1128
  ```typescript
1129
1129
  const T = Type.Object({ x: Type.Number(), y: Type.Number() }, { additionalProperties: false })
@@ -1203,7 +1203,7 @@ const R = Value.Equal( // const R = true
1203
1203
 
1204
1204
  ### Hash
1205
1205
 
1206
- Use the Hash function to create a [FNV1A-64](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non cryptographic hash of a value.
1206
+ Use the Hash function to create a [FNV1A-64](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non-cryptographic hash of a value.
1207
1207
 
1208
1208
  ```typescript
1209
1209
  const A = Value.Hash({ x: 1, y: 2, z: 3 }) // const A = 2910466848807138541n
@@ -1383,7 +1383,7 @@ type BasisVectors = Static<typeof BasisVectors> // type BasisVectors = {
1383
1383
 
1384
1384
  ### Options
1385
1385
 
1386
- Options can be passed via the last parameter
1386
+ Options can be passed via the last parameter.
1387
1387
 
1388
1388
  ```typescript
1389
1389
  const T = Syntax(`number`, { minimum: 42 }) // const T = {
@@ -1455,7 +1455,7 @@ const B = Value.Check(T, 'bar') // const B = false
1455
1455
 
1456
1456
  ## TypeCheck
1457
1457
 
1458
- TypeBox types target Json Schema Draft 7 and are compatible with any validator that supports this specification. TypeBox also provides a built in type checking compiler designed specifically for TypeBox types that offers high performance compilation and value checking.
1458
+ TypeBox types target Json Schema Draft 7 and are compatible with any validator that supports this specification. TypeBox also provides a built-in type checking compiler designed specifically for TypeBox types that offers high performance compilation and value checking.
1459
1459
 
1460
1460
  The following sections detail using Ajv and the TypeBox compiler infrastructure.
1461
1461
 
@@ -1574,7 +1574,7 @@ const C = TypeCompiler.Code(Type.String()) // const C = `return functi
1574
1574
 
1575
1575
  ## TypeMap
1576
1576
 
1577
- TypeBox offers an external package for bi-directional mapping between TypeBox, Valibot, and Zod type libraries. It also includes syntax parsing support for Valibot and Zod and supports the Standard Schema specification. For more details on TypeMap, refer to the project repository.
1577
+ TypeBox offers an external package for bidirectional mapping between TypeBox, Valibot, and Zod type libraries. It also includes syntax parsing support for Valibot and Zod and supports the Standard Schema specification. For more details on TypeMap, refer to the project repository.
1578
1578
 
1579
1579
  [TypeMap Repository](https://github.com/sinclairzx81/typemap)
1580
1580
 
@@ -1582,7 +1582,7 @@ TypeBox offers an external package for bi-directional mapping between TypeBox, V
1582
1582
 
1583
1583
  ### Usage
1584
1584
 
1585
- TypeMap needs to be installed seperately
1585
+ TypeMap needs to be installed separately
1586
1586
 
1587
1587
  ```bash
1588
1588
  $ npm install @sinclair/typemap
@@ -1731,11 +1731,11 @@ The following is a list of community packages that offer general tooling, extend
1731
1731
  | [json2typebox](https://github.com/hacxy/json2typebox) | Creating TypeBox code from Json Data |
1732
1732
  | [nominal-typebox](https://github.com/Coder-Spirit/nominal/tree/main/%40coderspirit/nominal-typebox) | Allows devs to integrate nominal types into TypeBox schemas |
1733
1733
  | [openapi-box](https://github.com/geut/openapi-box) | Generate TypeBox types from OpenApi IDL + Http client library |
1734
- | [prismabox](https://github.com/m1212e/prismabox) | Converts a prisma.schema to typebox schema matching the database models |
1734
+ | [prismabox](https://github.com/m1212e/prismabox) | Converts a prisma.schema to TypeBox schema matching the database models |
1735
1735
  | [schema2typebox](https://github.com/xddq/schema2typebox) | Creating TypeBox code from Json Schemas |
1736
1736
  | [sveltekit-superforms](https://github.com/ciscoheat/sveltekit-superforms) | A comprehensive SvelteKit form library for server and client validation |
1737
1737
  | [ts2typebox](https://github.com/xddq/ts2typebox) | Creating TypeBox code from Typescript types |
1738
- | [typebox-cli](https://github.com/gsuess/typebox-cli) | Generate Schema with typebox from the CLI |
1738
+ | [typebox-cli](https://github.com/gsuess/typebox-cli) | Generate Schema with TypeBox from the CLI |
1739
1739
  | [typebox-form-parser](https://github.com/jtlapp/typebox-form-parser) | Parses form and query data based on TypeBox schemas |
1740
1740
 
1741
1741