typebox 1.3.0 → 1.3.2

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.
@@ -1,3 +1,4 @@
1
+ import { Unreachable } from '../system/unreachable/index.mjs';
1
2
  import * as Puny from './_puny.mjs';
2
3
  // ------------------------------------------------------------------
3
4
  // Unicode General Category Helper (RFC 5892)
@@ -34,7 +35,8 @@ const RFC5892_DISALLOWED = new Set([
34
35
  // ------------------------------------------------------------------
35
36
  // A set of Virama (halant) code points used to validate CONTEXTJ
36
37
  // rules (RFC 5892 Appendix A.1). These characters allow a subsequent
37
- // Zero Width Joiner (U+200D) to be valid in a label.
38
+ // Zero Width Non-Joiner (U+200C) or Zero Width Joiner (U+200D) to
39
+ // be valid in a label.
38
40
  // ------------------------------------------------------------------
39
41
  const VIRAMA_CPS = new Set([
40
42
  0x094d,
@@ -101,8 +103,10 @@ function IsVirama(cp) {
101
103
  // IsUnicodeLabel
102
104
  // ------------------------------------------------------------------
103
105
  function IsUnicodeLabel(value) {
106
+ // deno-coverage-ignore-start - unable to reach via format guards
104
107
  if (value.length === 0)
105
- return false;
108
+ return Unreachable(); // false
109
+ // deno-coverage-ignore-stop
106
110
  // Use spread to handle surrogate pairs and provide O(1) neighbor access
107
111
  const cps = [...value].map((c) => c.codePointAt(0));
108
112
  const len = cps.length;
@@ -145,10 +149,17 @@ function IsUnicodeLabel(value) {
145
149
  if (prev === undefined || !IsHebrew(prev))
146
150
  return false;
147
151
  break; // Hebrew GERESH
148
- case 0x200d:
152
+ case 0x200c: // ZWNJ - RFC 5892 Appendix A.1
153
+ // Note: Full validation requires a Unicode joining type table. We reject
154
+ // only when preceded by ASCII (U+0000-U+007F), which can never satisfy
155
+ // the Virama or cursive-joining rules.
156
+ if (prev === undefined || (prev < 0x0080 && !IsVirama(prev)))
157
+ return false;
158
+ break;
159
+ case 0x200d: // ZWJ - RFC 5892 Appendix A.2
149
160
  if (prev === undefined || !IsVirama(prev))
150
161
  return false;
151
- break; // ZWJ
162
+ break;
152
163
  case 0x30fb: /* Checked at end via hasJapanese */
153
164
  break; // KATAKANA MIDDLE DOT
154
165
  }
@@ -1,3 +1,4 @@
1
+ import { Unreachable } from '../system/unreachable/index.mjs';
1
2
  // ------------------------------------------------------------------
2
3
  // PunyCode (RFC 3492)
3
4
  // ------------------------------------------------------------------
@@ -52,8 +53,10 @@ export function Decode(value) {
52
53
  digit = ch - 0x61; // a-z => 0-25
53
54
  else if (ch >= 0x30 && ch <= 0x39)
54
55
  digit = ch - 0x30 + 26; // 0-9 => 26-35
56
+ // deno-coverage-ignore-start - _idna.ts maps input to lowercase, so we can't reach here
55
57
  else if (ch >= 0x41 && ch <= 0x5a)
56
- digit = ch - 0x41; // A-Z => 0-25
58
+ Unreachable(); // digit = ch - 0x41 // A-Z => 0-25
59
+ // deno-coverage-ignore-stop
57
60
  else
58
61
  throw new Error('Invalid punycode: bad digit character');
59
62
  i += digit * w;
@@ -1,5 +1,5 @@
1
1
  import { Stack } from './_stack.mjs';
2
2
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
3
- export declare function BuildBooleanSchema(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
4
- export declare function CheckBooleanSchema(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
- export declare function ErrorBooleanSchema(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
3
+ export declare function BuildSchemaBoolean(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
4
+ export declare function CheckSchemaBoolean(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
+ export declare function ErrorSchemaBoolean(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
@@ -3,20 +3,20 @@ import { EmitGuard as E } from '../../guard/index.mjs';
3
3
  // ------------------------------------------------------------------
4
4
  // Build
5
5
  // ------------------------------------------------------------------
6
- export function BuildBooleanSchema(_stack, _context, schema, _value) {
6
+ export function BuildSchemaBoolean(_stack, _context, schema, _value) {
7
7
  return schema ? E.Constant(true) : E.Constant(false);
8
8
  }
9
9
  // ------------------------------------------------------------------
10
10
  // Check
11
11
  // ------------------------------------------------------------------
12
- export function CheckBooleanSchema(_stack, _context, schema, _value) {
12
+ export function CheckSchemaBoolean(_stack, _context, schema, _value) {
13
13
  return schema;
14
14
  }
15
15
  // ------------------------------------------------------------------
16
16
  // Error
17
17
  // ------------------------------------------------------------------
18
- export function ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema, value) {
19
- return CheckBooleanSchema(stack, context, schema, value) || context.AddError({
18
+ export function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
19
+ return CheckSchemaBoolean(stack, context, schema, value) || context.AddError({
20
20
  keyword: 'boolean',
21
21
  schemaPath,
22
22
  instancePath,
@@ -6,7 +6,7 @@ import { BuildAdditionalItems, CheckAdditionalItems, ErrorAdditionalItems } from
6
6
  import { BuildAdditionalProperties, CheckAdditionalProperties, ErrorAdditionalProperties } from './additionalProperties.mjs';
7
7
  import { BuildAllOf, CheckAllOf, ErrorAllOf } from './allOf.mjs';
8
8
  import { BuildAnyOf, CheckAnyOf, ErrorAnyOf } from './anyOf.mjs';
9
- import { BuildBooleanSchema, CheckBooleanSchema, ErrorBooleanSchema } from './boolean.mjs';
9
+ import { BuildSchemaBoolean, CheckSchemaBoolean, ErrorSchemaBoolean } from './boolean.mjs';
10
10
  import { BuildConst, CheckConst, ErrorConst } from './const.mjs';
11
11
  import { BuildContains, CheckContains, ErrorContains } from './contains.mjs';
12
12
  import { BuildDependencies, CheckDependencies, ErrorDependencies } from './dependencies.mjs';
@@ -125,8 +125,8 @@ export function BuildSchemaPushStack(stack, context, schema, value) {
125
125
  export function BuildSchema(stack, context, schema, value) {
126
126
  stack.Push(schema);
127
127
  const conditions = [];
128
- if (Schema.IsBooleanSchema(schema))
129
- return BuildBooleanSchema(stack, context, schema, value);
128
+ if (Schema.IsSchemaBoolean(schema))
129
+ return BuildSchemaBoolean(stack, context, schema, value);
130
130
  if (Schema.IsType(schema))
131
131
  conditions.push(BuildType(stack, context, schema, value));
132
132
  if (HasObjectKeywords(schema)) {
@@ -247,7 +247,7 @@ export function CheckSchemaPushStack(stack, context, schema, value) {
247
247
  }
248
248
  export function CheckSchema(stack, context, schema, value) {
249
249
  stack.Push(schema);
250
- const result = Schema.IsBooleanSchema(schema) ? CheckBooleanSchema(stack, context, schema, value) : ((!Schema.IsType(schema) || CheckType(stack, context, schema, value)) &&
250
+ const result = Schema.IsSchemaBoolean(schema) ? CheckSchemaBoolean(stack, context, schema, value) : ((!Schema.IsType(schema) || CheckType(stack, context, schema, value)) &&
251
251
  (!(G.IsObject(value) && !G.IsArray(value)) || ((!Schema.IsRequired(schema) || CheckRequired(stack, context, schema, value)) &&
252
252
  (!Schema.IsAdditionalProperties(schema) || CheckAdditionalProperties(stack, context, schema, value)) &&
253
253
  (!Schema.IsDependencies(schema) || CheckDependencies(stack, context, schema, value)) &&
@@ -300,7 +300,7 @@ export function ErrorSchemaPushStack(stack, context, schemaPath, instancePath, s
300
300
  }
301
301
  export function ErrorSchema(stack, context, schemaPath, instancePath, schema, value) {
302
302
  stack.Push(schema);
303
- const result = (Schema.IsBooleanSchema(schema)) ? ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema, value) : (!!(+(!Schema.IsType(schema) || ErrorType(stack, context, schemaPath, instancePath, schema, value)) &
303
+ const result = (Schema.IsSchemaBoolean(schema)) ? ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) : (!!(+(!Schema.IsType(schema) || ErrorType(stack, context, schemaPath, instancePath, schema, value)) &
304
304
  +(!(G.IsObject(value) && !G.IsArray(value)) || !!(+(!Schema.IsRequired(schema) || ErrorRequired(stack, context, schemaPath, instancePath, schema, value)) &
305
305
  +(!Schema.IsAdditionalProperties(schema) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value)) &
306
306
  +(!Schema.IsDependencies(schema) || ErrorDependencies(stack, context, schemaPath, instancePath, schema, value)) &
@@ -3,7 +3,7 @@ export type XSchemaObject = object;
3
3
  export declare function IsSchemaObject(value: unknown): value is XSchemaObject;
4
4
  export type XSchemaBoolean = boolean;
5
5
  /** Returns true if this value is a boolean */
6
- export declare function IsBooleanSchema(value: unknown): value is XSchemaBoolean;
6
+ export declare function IsSchemaBoolean(value: unknown): value is XSchemaBoolean;
7
7
  export type XSchema = XSchemaObject | XSchemaBoolean;
8
8
  /** Returns true if this value is schema like */
9
9
  export declare function IsSchema(value: unknown): value is XSchema;
@@ -5,10 +5,10 @@ export function IsSchemaObject(value) {
5
5
  return Guard.IsObject(value) && !Guard.IsArray(value);
6
6
  }
7
7
  /** Returns true if this value is a boolean */
8
- export function IsBooleanSchema(value) {
8
+ export function IsSchemaBoolean(value) {
9
9
  return Guard.IsBoolean(value);
10
10
  }
11
11
  /** Returns true if this value is schema like */
12
12
  export function IsSchema(value) {
13
- return IsSchemaObject(value) || IsBooleanSchema(value);
13
+ return IsSchemaObject(value) || IsSchemaBoolean(value);
14
14
  }
@@ -13,15 +13,16 @@ function FromClassInstance(value) {
13
13
  return value; // atomic
14
14
  }
15
15
  // ------------------------------------------------------------------
16
- // KindedObject
16
+ // TypeObject
17
17
  //
18
18
  // Types have non-enumerable properties that MUST be preserved on Clone.
19
19
  // The following is the optimal path for TypeBox types.
20
20
  // ------------------------------------------------------------------
21
- function IsKindedObject(value) {
22
- return Guard.HasPropertyKey(value, '~kind');
21
+ function IsTypeObject(value) {
22
+ return (Guard.HasPropertyKey(value, '~kind') ||
23
+ Guard.HasPropertyKey(value, '~unsafe'));
23
24
  }
24
- function FromKindedObject(value) {
25
+ function FromTypeObject(value) {
25
26
  const result = {};
26
27
  const descriptors = Object.getOwnPropertyDescriptors(value);
27
28
  for (const key of Object.keys(descriptors)) {
@@ -54,7 +55,7 @@ function FromPlainObject(value) {
54
55
  // ------------------------------------------------------------------
55
56
  function FromObject(value) {
56
57
  return (Guard.IsClassInstance(value) ? FromClassInstance(value) :
57
- IsKindedObject(value) ? FromKindedObject(value) :
58
+ IsTypeObject(value) ? FromTypeObject(value) :
58
59
  FromPlainObject(value));
59
60
  }
60
61
  // ------------------------------------------------------------------
@@ -3,6 +3,8 @@ import { type TTypeScriptEnumLike } from '../engine/enum/typescript_enum_to_enum
3
3
  import { type TTypeScriptEnumToEnumValues } from '../engine/enum/typescript_enum_to_enum_values.mjs';
4
4
  export type StaticEnum<Values extends TEnumValue[]> = (Values[number]);
5
5
  export type TEnumValue = string | number;
6
+ /** Returns true if the given value is a EnumValue */
7
+ export declare function IsEnumValue(value: unknown): value is TEnumValue;
6
8
  /** Represents an Enum type. */
7
9
  export interface TEnum<Values extends TEnumValue[] = TEnumValue[]> extends TSchema {
8
10
  '~kind': 'Enum';
@@ -1,8 +1,13 @@
1
1
  // deno-fmt-ignore-file
2
+ import { Guard } from '../../guard/index.mjs';
2
3
  import { Memory } from '../../system/memory/index.mjs';
3
4
  import { IsKind } from './schema.mjs';
4
5
  import { IsTypeScriptEnumLike } from '../engine/enum/typescript_enum_to_enum_values.mjs';
5
6
  import { TypeScriptEnumToEnumValues } from '../engine/enum/typescript_enum_to_enum_values.mjs';
7
+ /** Returns true if the given value is a EnumValue */
8
+ export function IsEnumValue(value) {
9
+ return Guard.IsString(value) || Guard.IsNumber(value);
10
+ }
6
11
  /** Creates an Enum type. */
7
12
  export function Enum(value, options) {
8
13
  const values = IsTypeScriptEnumLike(value) ? TypeScriptEnumToEnumValues(value) : value;
@@ -37,7 +37,7 @@ export { Boolean, IsBoolean, type TBoolean } from './type/types/boolean.mjs';
37
37
  export { Call, IsCall, type TCall } from './type/types/call.mjs';
38
38
  export { Constructor, IsConstructor, type TConstructor } from './type/types/constructor.mjs';
39
39
  export { Cyclic, IsCyclic, type TCyclic } from './type/types/cyclic.mjs';
40
- export { Enum, IsEnum, type TEnum, type TEnumValue } from './type/types/enum.mjs';
40
+ export { Enum, IsEnum, IsEnumValue, type TEnum, type TEnumValue } from './type/types/enum.mjs';
41
41
  export { Function, IsFunction, type TFunction } from './type/types/function.mjs';
42
42
  export { Generic, IsGeneric, type TGeneric } from './type/types/generic.mjs';
43
43
  export { Identifier, IsIdentifier, type TIdentifier } from './type/types/identifier.mjs';
package/build/typebox.mjs CHANGED
@@ -55,7 +55,7 @@ export { Boolean, IsBoolean } from './type/types/boolean.mjs';
55
55
  export { Call, IsCall } from './type/types/call.mjs';
56
56
  export { Constructor, IsConstructor } from './type/types/constructor.mjs';
57
57
  export { Cyclic, IsCyclic } from './type/types/cyclic.mjs';
58
- export { Enum, IsEnum } from './type/types/enum.mjs';
58
+ export { Enum, IsEnum, IsEnumValue } from './type/types/enum.mjs';
59
59
  export { Function, IsFunction } from './type/types/function.mjs';
60
60
  export { Generic, IsGeneric } from './type/types/generic.mjs';
61
61
  export { Identifier, IsIdentifier } from './type/types/identifier.mjs';
@@ -40,6 +40,17 @@ function AssertRepairableType(context, type, value) {
40
40
  }
41
41
  }
42
42
  // ------------------------------------------------------------------
43
+ // CreateWhenUndefined
44
+ //
45
+ // If the value is 'undefined' AND the type is not TUndefined, then
46
+ // we know the value must be created. We handle this case for undefined
47
+ // only as it enables 'default' annotation to be initialized via Create
48
+ // before we applying subsequent Repair logic.
49
+ // ------------------------------------------------------------------
50
+ function CreateWhenUndefined(context, type, value) {
51
+ return (Guard.IsUndefined(value) && !T.IsUndefined(type)) ? Create(context, type) : value;
52
+ }
53
+ // ------------------------------------------------------------------
43
54
  // FinalizeRepair
44
55
  //
45
56
  // When a type includes the ~refine modifier, a post-repair validation
@@ -62,15 +73,16 @@ function FinalizeRepair(context, type, repaired) {
62
73
  export function FromType(context, type, value) {
63
74
  AssertRepairableValue(context, type, value);
64
75
  AssertRepairableType(context, type, value);
65
- const repaired = (T.IsArray(type) ? FromArray(context, type, value) :
66
- T.IsEnum(type) ? FromEnum(context, type, value) :
67
- T.IsIntersect(type) ? FromIntersect(context, type, value) :
68
- T.IsObject(type) ? FromObject(context, type, value) :
69
- T.IsRecord(type) ? FromRecord(context, type, value) :
70
- T.IsRef(type) ? FromRef(context, type, value) :
71
- T.IsTemplateLiteral(type) ? FromTemplateLiteral(context, type, value) :
72
- T.IsTuple(type) ? FromTuple(context, type, value) :
73
- T.IsUnion(type) ? FromUnion(context, type, value) :
74
- FromUnknown(context, type, value));
76
+ const candidate = CreateWhenUndefined(context, type, value);
77
+ const repaired = (T.IsArray(type) ? FromArray(context, type, candidate) :
78
+ T.IsEnum(type) ? FromEnum(context, type, candidate) :
79
+ T.IsIntersect(type) ? FromIntersect(context, type, candidate) :
80
+ T.IsObject(type) ? FromObject(context, type, candidate) :
81
+ T.IsRecord(type) ? FromRecord(context, type, candidate) :
82
+ T.IsRef(type) ? FromRef(context, type, candidate) :
83
+ T.IsTemplateLiteral(type) ? FromTemplateLiteral(context, type, candidate) :
84
+ T.IsTuple(type) ? FromTuple(context, type, candidate) :
85
+ T.IsUnion(type) ? FromUnion(context, type, candidate) :
86
+ FromUnknown(context, type, candidate));
75
87
  return FinalizeRepair(context, type, repaired);
76
88
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typebox",
3
3
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "jsonschema"
package/readme.md CHANGED
@@ -113,21 +113,24 @@ type User = Type.Static<typeof User> // type User = {
113
113
 
114
114
  [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POv3b7k0AdAGUAxlGBgYACjwC5eAJS9G3VWvXdqdOADkAhiFQBnMHpGpKIiADsj8ALJ6YACzgBeREWFiJ0gAaUcHCEaHAAaqgiMNAATO5wAN5wZABccNYAriDEqFAANHBIaZnZuXAAvoHBROGR0VAAzPEAogBuegA2GU6oADwRUbFwAGSJcABexVk5UBUAfFUh6AP1ACwt7V09-XXQTaNJAO5TpbPlC35KygAiqGjWACao1vD6hiZmFla28En2xq5yvF+KhvOJJFIknIBI4XBUCn4gosahFYKgyPEElUgpAjMAYMAbGkVtBVnlseloCBOsTdo1yUEghlWrTBlAYlVKkElnAAOKoHCoGBQJCYimtXIE8xGWlosgAbQAugzGcBHsBpScZkrOcjQrDcsBOmLGXADMRgM8YKy1iqgg9gBgMBkjKgbaS7XATJEMh09FB3VBVrruTV-kZXB4saaAOYCwzCop8+NCkWe6kwQ00uAG8SdXWXLT0ABKGReoHQxdQGA6dUJ1ko4ecAjA2DQsEtRgEccFiZbbclnYEEo70oE+NQIC7rYg7YJxhbEDxBJs-dng4XZEbALXc6HPYTIt3G67I6lC4nU+PHYX1ipnWv867W6bj-3Kb7M73C7PGovmavL8TwEZk303bcIzArsMyzDooIEB0nRdUEgJvZ8IObVCnwEGC8zgrCh3NS0Xngl8dwIhdcKNfCBzQgRvREX1-VIos4CEGAnA1OAAElrAwXJnnMShnWsKJ6zgKBnieKApHeZw0hBYQOKlXolggDAcwBOYFESKo5O7D8j1-aV5QABkVRdl3rAQtyCfSD1TJBh0HEzzIEO8oGpODbLgezDKc4zjDMizQJ8-SqIfRDnVdGy9J3CK4KIq1Yrs+Kejw+i0EYv0oFi8ogA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POv3b7k0AdACpejbuImTu1OnAByAQxCoAzmAUBjVJQB2S1eq1wAsgpgALOAG9KcOKjKRYcDRB0r4ANVQaY0AExwALyIRAIA8sQAVj4wABRWcGQAXKGCcgCuIMSoUHEAlAA0cEip-KgCmdm5BXAAvvm29o7Q8K7uXrHQAMzBaRUAogBuCgA2GWaoceUCAJI6MLkqsXEA2t6+AcUzkTG+CXAAXmVhVTl5+fX5ALr5jXYOTm1uHnAbflAALH0zw2MTi2mYXmiygy326y6UG62zCuxWiQA7id0llzrUGrdGnUZPQACKoNA6AAmqAW8n0ak02nar28sAcPzh0QRTUgKmAMGAblSpgsAne0E+hSaOmgIDGvLM5gFUJhTQyQyl-MFUH8lAalFp8AA4qgcKgYFAkEzBPD9jY7ENclytCoURUAIJQKAKJBxemLMhFJrAEnAO0OgTO13umZnGp3DWNbUmSZQYBjU0Vc3xS1wJTEYBkmDKmWq4VNYnADAYDLLPOyzZfEV2NQ+DKjBRQSsF6Nal7wYyqSwhHYsi1NADm+uURtKcD1BvHtbgEtBidGytyi-bogAShkFqB0OvUBhRrFuTpKN2VDKwNg0LBsyoBCPp8aBJeINeuaoBNab3aBJzUCA7xfN9b2fCAOS5NxnyvG0QLIU8eyg18YI-B8xyfIDkLvL9bQ-P8AMQ4CPzFKAJVGAjMIEOCzwvaCbxQ0dDXQ2j3ywmCfzwwDmJAxVyLou8qIQjC+IEecVzGXiWIEYtS3LCohMkgTzwkkDRITcT5JAzNswWZSP0UmikOE1TF10u96w0Rtm1MyjcTgABlGAzADOB5gwXIyS0Sgyx0XxjzgKAyVJPJlHPIMHKcjQAB5CDQCAMBMHsAD5LnTEKZVQxikE-NjVFWAAGa5QPA48bLsNL7wY8dsu-XKCoEYjSNKucEIyqrsIDWrCp4uCyoQ4zxOkstlia8r+rIrScxGvr4xM8zLKgGy6iAA) | [Challenge](test/typescript/readme.md)
115
115
 
116
- TypeBox includes a syntax engine that can transform TypeScript declarations into JSON Schema. The engine is a full syntactic frontend to Type.* and supports many advanced type-level constructs such as Conditional, Mapped, Indexed, Infer, Generics, Distributed types and more. This feature is implemented symmetrically at runtime and statically via TypeScript Template Literal types.
116
+ TypeBox includes a syntax engine that can transform TypeScript declarations into JSON Schema. The engine is a full syntactic frontend to Type.* and supports many advanced type-level constructs such as Conditional, Mapped, Indexed, Infer, Generics, Distributed types and more. This feature is implemented symmetrically at runtime and statically via TypeScript Template Literal types.
117
+
118
+ Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
119
+
117
120
 
118
121
  ### Example
119
122
 
120
- The following uses Script to parse TypeScript declarations into JSON Schema.
123
+ The following uses Script to parse TypeScript declarations into JSON Schema.
121
124
 
122
125
  ```typescript
123
- // Namespace
126
+ // Module
124
127
  const Math = Type.Script(`
125
128
  type Vector2 = { x: number, y: number }
126
129
  type Vector3 = Evaluate<Vector2 & { z: number }>
127
130
  type Vector4 = Evaluate<Vector3 & { w: number }>
128
131
  `)
129
132
 
130
- // Dependent Namespace
133
+ // Dependent Module
131
134
  const { Mesh } = Type.Script({ ...Math }, `
132
135
  type Vertex = {
133
136
  position: Vector4,