@sinclair/typebox 0.34.15 → 0.34.16

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.
Files changed (83) hide show
  1. package/build/cjs/syntax/index.d.ts +1 -1
  2. package/build/cjs/syntax/index.js +1 -1
  3. package/build/cjs/syntax/runtime.d.ts +38 -54
  4. package/build/cjs/syntax/runtime.js +60 -202
  5. package/build/cjs/syntax/static.d.ts +62 -148
  6. package/build/cjs/syntax/syntax.d.ts +33 -0
  7. package/build/cjs/syntax/syntax.js +37 -0
  8. package/build/cjs/type/constructor-parameters/constructor-parameters.d.ts +3 -3
  9. package/build/cjs/type/constructor-parameters/constructor-parameters.js +3 -1
  10. package/build/cjs/type/instance-type/instance-type.d.ts +5 -4
  11. package/build/cjs/type/instance-type/instance-type.js +3 -1
  12. package/build/cjs/type/parameters/parameters.d.ts +3 -3
  13. package/build/cjs/type/parameters/parameters.js +3 -1
  14. package/build/cjs/type/return-type/return-type.d.ts +5 -4
  15. package/build/cjs/type/return-type/return-type.js +3 -1
  16. package/build/cjs/type/type/javascript.d.ts +4 -4
  17. package/build/esm/syntax/index.d.mts +1 -1
  18. package/build/esm/syntax/index.mjs +1 -1
  19. package/build/esm/syntax/runtime.d.mts +38 -54
  20. package/build/esm/syntax/runtime.mjs +60 -202
  21. package/build/esm/syntax/static.d.mts +62 -148
  22. package/build/esm/syntax/syntax.d.mts +33 -0
  23. package/build/esm/syntax/syntax.mjs +30 -0
  24. package/build/esm/type/constructor-parameters/constructor-parameters.d.mts +3 -3
  25. package/build/esm/type/constructor-parameters/constructor-parameters.mjs +3 -1
  26. package/build/esm/type/instance-type/instance-type.d.mts +5 -4
  27. package/build/esm/type/instance-type/instance-type.mjs +3 -1
  28. package/build/esm/type/parameters/parameters.d.mts +3 -3
  29. package/build/esm/type/parameters/parameters.mjs +3 -1
  30. package/build/esm/type/return-type/return-type.d.mts +5 -4
  31. package/build/esm/type/return-type/return-type.mjs +3 -1
  32. package/build/esm/type/type/javascript.d.mts +4 -4
  33. package/package.json +11 -1
  34. package/parser/package.json +4 -0
  35. package/readme.md +86 -160
  36. package/build/cjs/syntax/parse.d.ts +0 -15
  37. package/build/cjs/syntax/parse.js +0 -19
  38. package/build/esm/syntax/parse.d.mts +0 -15
  39. package/build/esm/syntax/parse.mjs +0 -14
  40. /package/build/cjs/{syntax/parsebox → parser}/index.d.ts +0 -0
  41. /package/build/cjs/{syntax/parsebox → parser}/index.js +0 -0
  42. /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.d.ts +0 -0
  43. /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.js +0 -0
  44. /package/build/cjs/{syntax/parsebox → parser}/runtime/index.d.ts +0 -0
  45. /package/build/cjs/{syntax/parsebox → parser}/runtime/index.js +0 -0
  46. /package/build/cjs/{syntax/parsebox → parser}/runtime/module.d.ts +0 -0
  47. /package/build/cjs/{syntax/parsebox → parser}/runtime/module.js +0 -0
  48. /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.d.ts +0 -0
  49. /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.js +0 -0
  50. /package/build/cjs/{syntax/parsebox → parser}/runtime/token.d.ts +0 -0
  51. /package/build/cjs/{syntax/parsebox → parser}/runtime/token.js +0 -0
  52. /package/build/cjs/{syntax/parsebox → parser}/runtime/types.d.ts +0 -0
  53. /package/build/cjs/{syntax/parsebox → parser}/runtime/types.js +0 -0
  54. /package/build/cjs/{syntax/parsebox → parser}/static/index.d.ts +0 -0
  55. /package/build/cjs/{syntax/parsebox → parser}/static/index.js +0 -0
  56. /package/build/cjs/{syntax/parsebox → parser}/static/parse.d.ts +0 -0
  57. /package/build/cjs/{syntax/parsebox → parser}/static/parse.js +0 -0
  58. /package/build/cjs/{syntax/parsebox → parser}/static/token.d.ts +0 -0
  59. /package/build/cjs/{syntax/parsebox → parser}/static/token.js +0 -0
  60. /package/build/cjs/{syntax/parsebox → parser}/static/types.d.ts +0 -0
  61. /package/build/cjs/{syntax/parsebox → parser}/static/types.js +0 -0
  62. /package/build/esm/{syntax/parsebox → parser}/index.d.mts +0 -0
  63. /package/build/esm/{syntax/parsebox → parser}/index.mjs +0 -0
  64. /package/build/esm/{syntax/parsebox → parser}/runtime/guard.d.mts +0 -0
  65. /package/build/esm/{syntax/parsebox → parser}/runtime/guard.mjs +0 -0
  66. /package/build/esm/{syntax/parsebox → parser}/runtime/index.d.mts +0 -0
  67. /package/build/esm/{syntax/parsebox → parser}/runtime/index.mjs +0 -0
  68. /package/build/esm/{syntax/parsebox → parser}/runtime/module.d.mts +0 -0
  69. /package/build/esm/{syntax/parsebox → parser}/runtime/module.mjs +0 -0
  70. /package/build/esm/{syntax/parsebox → parser}/runtime/parse.d.mts +0 -0
  71. /package/build/esm/{syntax/parsebox → parser}/runtime/parse.mjs +0 -0
  72. /package/build/esm/{syntax/parsebox → parser}/runtime/token.d.mts +0 -0
  73. /package/build/esm/{syntax/parsebox → parser}/runtime/token.mjs +0 -0
  74. /package/build/esm/{syntax/parsebox → parser}/runtime/types.d.mts +0 -0
  75. /package/build/esm/{syntax/parsebox → parser}/runtime/types.mjs +0 -0
  76. /package/build/esm/{syntax/parsebox → parser}/static/index.d.mts +0 -0
  77. /package/build/esm/{syntax/parsebox → parser}/static/index.mjs +0 -0
  78. /package/build/esm/{syntax/parsebox → parser}/static/parse.d.mts +0 -0
  79. /package/build/esm/{syntax/parsebox → parser}/static/parse.mjs +0 -0
  80. /package/build/esm/{syntax/parsebox → parser}/static/token.d.mts +0 -0
  81. /package/build/esm/{syntax/parsebox → parser}/static/token.mjs +0 -0
  82. /package/build/esm/{syntax/parsebox → parser}/static/types.d.mts +0 -0
  83. /package/build/esm/{syntax/parsebox → parser}/static/types.mjs +0 -0
@@ -1 +1 @@
1
- export * from './parse';
1
+ export * from './syntax';
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- __exportStar(require("./parse"), exports);
18
+ __exportStar(require("./syntax"), exports);
@@ -1,71 +1,55 @@
1
- import { Runtime } from './parsebox/index';
2
- import * as Types from '../type/index';
1
+ import { Runtime } from '../parser/index';
2
+ import * as t from '../type/index';
3
3
  export declare const Module: Runtime.Module<{
4
- ExportModifier: Runtime.IUnion<boolean>;
5
- HeritageList: Runtime.IUnion<Types.TSchema[]>;
6
- Heritage: Runtime.IUnion<unknown[]>;
7
- InterfaceDeclaration: Runtime.ITuple<{
8
- [x: string]: Types.TIntersect<[...Types.TRef<string>[], Types.TObject<Types.TProperties>]>;
9
- }>;
10
- TypeAliasDeclaration: Runtime.ITuple<{
11
- [x: string]: Types.TSchema;
12
- }>;
13
- ModuleType: Runtime.IUnion<unknown>;
14
- ModuleProperties: Runtime.IUnion<Types.TProperties>;
15
- ModuleDeclaration: Runtime.ITuple<Types.TModule<Types.TProperties, {
16
- [x: string]: Types.TSchema;
17
- [x: number]: Types.TSchema;
18
- }>>;
19
- Literal: Runtime.IUnion<Types.TLiteral<string> | Types.TLiteral<number> | Types.TLiteral<boolean>>;
20
- Keyword: Runtime.IUnion<Types.TAny | Types.TNever | Types.TString | Types.TBoolean | Types.TNumber | Types.TInteger | Types.TBigInt | Types.TNull | Types.TSymbol | Types.TUndefined | Types.TUnknown | Types.TVoid>;
4
+ Literal: Runtime.IUnion<t.TLiteral<string> | t.TLiteral<number> | t.TLiteral<boolean>>;
5
+ Keyword: Runtime.IUnion<t.TAny | t.TNever | t.TString | t.TBoolean | t.TNumber | t.TInteger | t.TBigInt | t.TNull | t.TSymbol | t.TUndefined | t.TUnknown | t.TVoid>;
21
6
  KeyOf: Runtime.IUnion<boolean>;
22
7
  IndexArray: Runtime.IUnion<unknown[]>;
23
8
  Extends: Runtime.IUnion<unknown[]>;
24
9
  Base: Runtime.IUnion<unknown>;
25
- Factor: Runtime.ITuple<Types.TSchema>;
10
+ Factor: Runtime.ITuple<t.TSchema>;
26
11
  ExprTermTail: Runtime.IUnion<[] | ["&", unknown, unknown]>;
27
- ExprTerm: Runtime.ITuple<Types.TSchema>;
12
+ ExprTerm: Runtime.ITuple<t.TSchema>;
28
13
  ExprTail: Runtime.IUnion<[] | ["|", unknown, unknown]>;
29
- Expr: Runtime.ITuple<Types.TSchema>;
14
+ Expr: Runtime.ITuple<t.TSchema>;
30
15
  Type: Runtime.IRef<unknown>;
31
16
  PropertyKey: Runtime.IUnion<string>;
32
17
  Readonly: Runtime.IUnion<boolean>;
33
18
  Optional: Runtime.IUnion<boolean>;
34
19
  Property: Runtime.ITuple<{
35
- [x: string]: Types.TSchema;
20
+ [x: string]: t.TSchema;
36
21
  }>;
37
22
  PropertyDelimiter: Runtime.IUnion<[","] | [",", "\n"] | [";"] | [";", "\n"] | ["\n"]>;
38
- Properties: Runtime.IUnion<Types.TProperties>;
39
- Object: Runtime.ITuple<Types.TObject<Types.TProperties>>;
23
+ Properties: Runtime.IUnion<t.TProperties>;
24
+ Object: Runtime.ITuple<t.TObject<t.TProperties>>;
40
25
  Elements: Runtime.IUnion<unknown[]>;
41
- Tuple: Runtime.ITuple<Types.TTuple<Types.TSchema[]>>;
42
- Parameter: Runtime.ITuple<Types.TSchema>;
43
- Function: Runtime.ITuple<Types.TFunction<Types.TSchema[], Types.TSchema>>;
26
+ Tuple: Runtime.ITuple<t.TTuple<t.TSchema[]>>;
27
+ Parameter: Runtime.ITuple<t.TSchema>;
28
+ Function: Runtime.ITuple<t.TFunction<t.TSchema[], t.TSchema>>;
44
29
  Parameters: Runtime.IUnion<unknown[]>;
45
- Constructor: Runtime.ITuple<Types.TConstructor<Types.TSchema[], Types.TSchema>>;
46
- Mapped: Runtime.ITuple<Types.TLiteral<"Mapped types not supported">>;
47
- AsyncIterator: Runtime.ITuple<Types.TAsyncIterator<Types.TSchema>>;
48
- Iterator: Runtime.ITuple<Types.TIterator<Types.TSchema>>;
49
- Awaited: Runtime.ITuple<Types.TSchema>;
50
- Array: Runtime.ITuple<Types.TArray<Types.TSchema>>;
51
- Record: Runtime.ITuple<Types.TNever>;
52
- Promise: Runtime.ITuple<Types.TPromise<Types.TSchema>>;
53
- ConstructorParameters: Runtime.ITuple<Types.TTuple<Types.TSchema[]>>;
54
- FunctionParameters: Runtime.ITuple<Types.TTuple<Types.TSchema[]>>;
55
- InstanceType: Runtime.ITuple<Types.TSchema>;
56
- ReturnType: Runtime.ITuple<Types.TSchema>;
57
- Partial: Runtime.ITuple<Types.TObject<{}>>;
58
- Required: Runtime.ITuple<Types.TObject<{}>>;
59
- Pick: Runtime.ITuple<Types.TObject<{}>>;
60
- Omit: Runtime.ITuple<Types.TObject<{}>>;
61
- Exclude: Runtime.ITuple<Types.TNever>;
62
- Extract: Runtime.ITuple<Types.TSchema>;
63
- Uppercase: Runtime.ITuple<Types.TSchema>;
64
- Lowercase: Runtime.ITuple<Types.TSchema>;
65
- Capitalize: Runtime.ITuple<Types.TSchema>;
66
- Uncapitalize: Runtime.ITuple<Types.TSchema>;
67
- Date: Runtime.IConst<Types.TDate>;
68
- Uint8Array: Runtime.IConst<Types.TUint8Array>;
69
- Reference: Runtime.IIdent<Types.TSchema>;
70
- Main: Runtime.IUnion<unknown>;
30
+ Constructor: Runtime.ITuple<t.TConstructor<t.TSchema[], t.TSchema>>;
31
+ Mapped: Runtime.ITuple<t.TLiteral<"Mapped types not supported">>;
32
+ AsyncIterator: Runtime.ITuple<t.TAsyncIterator<t.TSchema>>;
33
+ Iterator: Runtime.ITuple<t.TIterator<t.TSchema>>;
34
+ Awaited: Runtime.ITuple<t.TSchema>;
35
+ Array: Runtime.ITuple<t.TArray<t.TSchema>>;
36
+ Record: Runtime.ITuple<t.TNever>;
37
+ Promise: Runtime.ITuple<t.TPromise<t.TSchema>>;
38
+ ConstructorParameters: Runtime.ITuple<t.TTuple<t.TSchema[]>>;
39
+ FunctionParameters: Runtime.ITuple<t.TTuple<t.TSchema[]>>;
40
+ InstanceType: Runtime.ITuple<t.TSchema>;
41
+ ReturnType: Runtime.ITuple<t.TSchema>;
42
+ Partial: Runtime.ITuple<t.TObject<{}>>;
43
+ Required: Runtime.ITuple<t.TObject<{}>>;
44
+ Pick: Runtime.ITuple<t.TObject<{}>>;
45
+ Omit: Runtime.ITuple<t.TObject<{}>>;
46
+ Exclude: Runtime.ITuple<t.TNever>;
47
+ Extract: Runtime.ITuple<t.TSchema>;
48
+ Uppercase: Runtime.ITuple<t.TSchema>;
49
+ Lowercase: Runtime.ITuple<t.TSchema>;
50
+ Capitalize: Runtime.ITuple<t.TSchema>;
51
+ Uncapitalize: Runtime.ITuple<t.TSchema>;
52
+ Date: Runtime.IConst<t.TDate>;
53
+ Uint8Array: Runtime.IConst<t.TUint8Array>;
54
+ Reference: Runtime.IIdent<t.TSchema>;
71
55
  }>;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Module = void 0;
5
- const index_1 = require("./parsebox/index");
6
- const Types = require("../type/index");
5
+ const index_1 = require("../parser/index");
6
+ const t = require("../type/index");
7
7
  // ------------------------------------------------------------------
8
8
  // Tokens
9
9
  // ------------------------------------------------------------------
@@ -37,126 +37,9 @@ function DestructureRight(values) {
37
37
  // Deref
38
38
  // ------------------------------------------------------------------
39
39
  const Deref = (context, key) => {
40
- return key in context ? context[key] : Types.Ref(key);
40
+ return key in context ? context[key] : t.Ref(key);
41
41
  };
42
42
  // ------------------------------------------------------------------
43
- // ExportModifier
44
- // ------------------------------------------------------------------
45
- // prettier-ignore
46
- const ExportModifierMapping = (values) => {
47
- return values.length === 1;
48
- };
49
- // prettier-ignore
50
- const ExportModifier = index_1.Runtime.Union([
51
- index_1.Runtime.Tuple([index_1.Runtime.Const('export')]), index_1.Runtime.Tuple([])
52
- ], ExportModifierMapping);
53
- // ------------------------------------------------------------------
54
- // TypeAliasDeclaration
55
- // ------------------------------------------------------------------
56
- // prettier-ignore
57
- const TypeAliasDeclarationMapping = (_Export, _Keyword, Ident, _Equals, Type) => {
58
- return { [Ident]: Type };
59
- };
60
- // prettier-ignore
61
- const TypeAliasDeclaration = index_1.Runtime.Tuple([
62
- index_1.Runtime.Ref('ExportModifier'),
63
- index_1.Runtime.Const('type'),
64
- index_1.Runtime.Ident(),
65
- index_1.Runtime.Const(Equals),
66
- index_1.Runtime.Ref('Type')
67
- ], value => TypeAliasDeclarationMapping(...value));
68
- // ------------------------------------------------------------------
69
- // HeritageList
70
- // ------------------------------------------------------------------
71
- // prettier-ignore (note, heritage list should disallow trailing comma)
72
- const HeritageListDelimiter = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.Const(Comma), index_1.Runtime.Const(Newline)]), index_1.Runtime.Tuple([index_1.Runtime.Const(Comma)])]);
73
- // prettier-ignore
74
- const HeritageListMapping = (values, context) => {
75
- return (values.length === 3 ? [Deref(context, values[0]), ...values[2]] :
76
- values.length === 1 ? [Deref(context, values[0])] :
77
- []);
78
- };
79
- // prettier-ignore
80
- const HeritageList = index_1.Runtime.Union([
81
- index_1.Runtime.Tuple([index_1.Runtime.Ident(), HeritageListDelimiter, index_1.Runtime.Ref('HeritageList')]),
82
- index_1.Runtime.Tuple([index_1.Runtime.Ident()]),
83
- index_1.Runtime.Tuple([])
84
- ], HeritageListMapping);
85
- // ------------------------------------------------------------------
86
- // Heritage
87
- // ------------------------------------------------------------------
88
- // prettier-ignore
89
- const HeritageMapping = (values) => {
90
- return (values.length === 2 ? values[1] : []);
91
- };
92
- // prettier-ignore
93
- const Heritage = index_1.Runtime.Union([
94
- index_1.Runtime.Tuple([index_1.Runtime.Const('extends'), index_1.Runtime.Ref('HeritageList')]),
95
- index_1.Runtime.Tuple([])
96
- ], HeritageMapping);
97
- // ------------------------------------------------------------------
98
- // InterfaceDeclaration
99
- // ------------------------------------------------------------------
100
- // prettier-ignore
101
- const InterfaceDeclarationMapping = (_0, _1, Ident, Heritage, _4, Properties, _6) => {
102
- return { [Ident]: Types.Intersect([...Heritage, Types.Object(Properties)]) };
103
- };
104
- // prettier-ignore
105
- const InterfaceDeclaration = index_1.Runtime.Tuple([
106
- index_1.Runtime.Ref('ExportModifier'),
107
- index_1.Runtime.Const('interface'),
108
- index_1.Runtime.Ident(),
109
- index_1.Runtime.Ref('Heritage'),
110
- index_1.Runtime.Const(LBrace),
111
- index_1.Runtime.Ref('Properties'),
112
- index_1.Runtime.Const(RBrace),
113
- ], values => InterfaceDeclarationMapping(...values));
114
- // ------------------------------------------------------------------
115
- // ModuleType
116
- // ------------------------------------------------------------------
117
- // prettier-ignore
118
- const ModuleType = index_1.Runtime.Union([
119
- index_1.Runtime.Ref('InterfaceDeclaration'),
120
- index_1.Runtime.Ref('TypeAliasDeclaration')
121
- ]);
122
- // ------------------------------------------------------------------
123
- // ModuleProperties
124
- // ------------------------------------------------------------------
125
- // prettier-ignore
126
- const ModulePropertiesDelimiter = index_1.Runtime.Union([
127
- index_1.Runtime.Tuple([index_1.Runtime.Const(SemiColon), index_1.Runtime.Const(Newline)]),
128
- index_1.Runtime.Tuple([index_1.Runtime.Const(SemiColon)]),
129
- index_1.Runtime.Tuple([index_1.Runtime.Const(Newline)]),
130
- ]);
131
- // prettier-ignore
132
- const ModulePropertiesMapping = (values) => {
133
- return (values.length === 3 ? { ...values[0], ...values[2] } :
134
- values.length === 1 ? values[0] :
135
- {});
136
- };
137
- // prettier-ignore
138
- const ModuleProperties = index_1.Runtime.Union([
139
- index_1.Runtime.Tuple([index_1.Runtime.Ref('ModuleType'), ModulePropertiesDelimiter, index_1.Runtime.Ref('ModuleProperties')]),
140
- index_1.Runtime.Tuple([index_1.Runtime.Ref('ModuleType')]),
141
- index_1.Runtime.Tuple([]),
142
- ], ModulePropertiesMapping);
143
- // ------------------------------------------------------------------
144
- // ModuleDeclaration
145
- // ------------------------------------------------------------------
146
- // prettier-ignore
147
- const ModuleIdentifier = index_1.Runtime.Union([
148
- index_1.Runtime.Tuple([index_1.Runtime.Ident()]),
149
- index_1.Runtime.Tuple([])
150
- ]);
151
- // prettier-ignore
152
- const ModuleDeclarationMapping = (_1, _2, _Ident, _3, Properties, _5) => {
153
- return Types.Module(Properties);
154
- };
155
- // prettier-ignore
156
- const ModuleDeclaration = index_1.Runtime.Tuple([
157
- index_1.Runtime.Ref('ExportModifier'), index_1.Runtime.Const('module'), ModuleIdentifier, index_1.Runtime.Const(LBrace), index_1.Runtime.Ref('ModuleProperties'), index_1.Runtime.Const(RBrace)
158
- ], values => ModuleDeclarationMapping(...values));
159
- // ------------------------------------------------------------------
160
43
  // Reference
161
44
  // ------------------------------------------------------------------
162
45
  // prettier-ignore
@@ -166,27 +49,27 @@ const Reference = index_1.Runtime.Ident((value, context) => Deref(context, value
166
49
  // ------------------------------------------------------------------
167
50
  // prettier-ignore
168
51
  const Literal = index_1.Runtime.Union([
169
- index_1.Runtime.Union([index_1.Runtime.Const('true'), index_1.Runtime.Const('false')], value => Types.Literal(value === 'true')),
170
- index_1.Runtime.Number(value => Types.Literal(parseFloat(value))),
171
- index_1.Runtime.String([SingleQuote, DoubleQuote, Tilde], value => Types.Literal(value))
52
+ index_1.Runtime.Union([index_1.Runtime.Const('true'), index_1.Runtime.Const('false')], value => t.Literal(value === 'true')),
53
+ index_1.Runtime.Number(value => t.Literal(parseFloat(value))),
54
+ index_1.Runtime.String([SingleQuote, DoubleQuote, Tilde], value => t.Literal(value))
172
55
  ]);
173
56
  // ------------------------------------------------------------------
174
57
  // Keyword
175
58
  // ------------------------------------------------------------------
176
59
  // prettier-ignore
177
60
  const Keyword = index_1.Runtime.Union([
178
- index_1.Runtime.Const('any', index_1.Runtime.As(Types.Any())),
179
- index_1.Runtime.Const('bigint', index_1.Runtime.As(Types.BigInt())),
180
- index_1.Runtime.Const('boolean', index_1.Runtime.As(Types.Boolean())),
181
- index_1.Runtime.Const('integer', index_1.Runtime.As(Types.Integer())),
182
- index_1.Runtime.Const('never', index_1.Runtime.As(Types.Never())),
183
- index_1.Runtime.Const('null', index_1.Runtime.As(Types.Null())),
184
- index_1.Runtime.Const('number', index_1.Runtime.As(Types.Number())),
185
- index_1.Runtime.Const('string', index_1.Runtime.As(Types.String())),
186
- index_1.Runtime.Const('symbol', index_1.Runtime.As(Types.Symbol())),
187
- index_1.Runtime.Const('undefined', index_1.Runtime.As(Types.Undefined())),
188
- index_1.Runtime.Const('unknown', index_1.Runtime.As(Types.Unknown())),
189
- index_1.Runtime.Const('void', index_1.Runtime.As(Types.Void())),
61
+ index_1.Runtime.Const('any', index_1.Runtime.As(t.Any())),
62
+ index_1.Runtime.Const('bigint', index_1.Runtime.As(t.BigInt())),
63
+ index_1.Runtime.Const('boolean', index_1.Runtime.As(t.Boolean())),
64
+ index_1.Runtime.Const('integer', index_1.Runtime.As(t.Integer())),
65
+ index_1.Runtime.Const('never', index_1.Runtime.As(t.Never())),
66
+ index_1.Runtime.Const('null', index_1.Runtime.As(t.Null())),
67
+ index_1.Runtime.Const('number', index_1.Runtime.As(t.Number())),
68
+ index_1.Runtime.Const('string', index_1.Runtime.As(t.String())),
69
+ index_1.Runtime.Const('symbol', index_1.Runtime.As(t.Symbol())),
70
+ index_1.Runtime.Const('undefined', index_1.Runtime.As(t.Undefined())),
71
+ index_1.Runtime.Const('unknown', index_1.Runtime.As(t.Unknown())),
72
+ index_1.Runtime.Const('void', index_1.Runtime.As(t.Void())),
190
73
  ]);
191
74
  // ------------------------------------------------------------------
192
75
  // KeyOf
@@ -277,22 +160,22 @@ const Base = index_1.Runtime.Union([
277
160
  // prettier-ignore
278
161
  const FactorExtends = (Type, Extends) => {
279
162
  return Extends.length === 3
280
- ? Types.Extends(Type, Extends[0], Extends[1], Extends[2])
163
+ ? t.Extends(Type, Extends[0], Extends[1], Extends[2])
281
164
  : Type;
282
165
  };
283
166
  // prettier-ignore
284
167
  const FactorIndexArray = (Type, IndexArray) => {
285
168
  const [Left, Right] = DestructureRight(IndexArray);
286
- return (!Types.ValueGuard.IsUndefined(Right) ? (
169
+ return (!t.ValueGuard.IsUndefined(Right) ? (
287
170
  // note: Indexed types require reimplementation to replace `[number]` indexers
288
- Right.length === 1 ? Types.Index(FactorIndexArray(Type, Left), Right[0]) :
289
- Right.length === 0 ? Types.Array(FactorIndexArray(Type, Left)) :
290
- Types.Never()) : Type);
171
+ Right.length === 1 ? t.Index(FactorIndexArray(Type, Left), Right[0]) :
172
+ Right.length === 0 ? t.Array(FactorIndexArray(Type, Left)) :
173
+ t.Never()) : Type);
291
174
  };
292
175
  // prettier-ignore
293
176
  const FactorMapping = (KeyOf, Type, IndexArray, Extends) => {
294
177
  return KeyOf
295
- ? FactorExtends(Types.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
178
+ ? FactorExtends(t.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
296
179
  : FactorExtends(FactorIndexArray(Type, IndexArray), Extends);
297
180
  };
298
181
  // prettier-ignore
@@ -311,14 +194,14 @@ function ExprBinaryMapping(Left, Rest) {
311
194
  const [Operator, Right, Next] = Rest;
312
195
  const Schema = ExprBinaryMapping(Right, Next);
313
196
  if (Operator === '&') {
314
- return Types.TypeGuard.IsIntersect(Schema)
315
- ? Types.Intersect([Left, ...Schema.allOf])
316
- : Types.Intersect([Left, Schema]);
197
+ return t.TypeGuard.IsIntersect(Schema)
198
+ ? t.Intersect([Left, ...Schema.allOf])
199
+ : t.Intersect([Left, Schema]);
317
200
  }
318
201
  if (Operator === '|') {
319
- return Types.TypeGuard.IsUnion(Schema)
320
- ? Types.Union([Left, ...Schema.anyOf])
321
- : Types.Union([Left, Schema]);
202
+ return t.TypeGuard.IsUnion(Schema)
203
+ ? t.Union([Left, ...Schema.anyOf])
204
+ : t.Union([Left, Schema]);
322
205
  }
323
206
  throw 1;
324
207
  })() : Left);
@@ -353,9 +236,9 @@ const Readonly = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.C
353
236
  const Optional = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.Const(Question)]), index_1.Runtime.Tuple([])], (value) => value.length > 0);
354
237
  // prettier-ignore
355
238
  const PropertyMapping = (IsReadonly, Key, IsOptional, _, Type) => ({
356
- [Key]: (IsReadonly && IsOptional ? Types.ReadonlyOptional(Type) :
357
- IsReadonly && !IsOptional ? Types.Readonly(Type) :
358
- !IsReadonly && IsOptional ? Types.Optional(Type) :
239
+ [Key]: (IsReadonly && IsOptional ? t.ReadonlyOptional(Type) :
240
+ IsReadonly && !IsOptional ? t.Readonly(Type) :
241
+ !IsReadonly && IsOptional ? t.Optional(Type) :
359
242
  Type)
360
243
  });
361
244
  // prettier-ignore
@@ -388,7 +271,7 @@ const Properties = index_1.Runtime.Union([
388
271
  // Object
389
272
  // ------------------------------------------------------------------
390
273
  // prettier-ignore
391
- const ObjectMapping = (_0, Properties, _2) => Types.Object(Properties);
274
+ const ObjectMapping = (_0, Properties, _2) => t.Object(Properties);
392
275
  // prettier-ignore
393
276
  const _Object = index_1.Runtime.Tuple([
394
277
  index_1.Runtime.Const(LBrace),
@@ -413,7 +296,7 @@ const Tuple = index_1.Runtime.Tuple([
413
296
  index_1.Runtime.Const(LBracket),
414
297
  index_1.Runtime.Ref('Elements'),
415
298
  index_1.Runtime.Const(RBracket)
416
- ], value => Types.Tuple(value[1]));
299
+ ], value => t.Tuple(value[1]));
417
300
  // ------------------------------------------------------------------
418
301
  // Parameters
419
302
  // ------------------------------------------------------------------
@@ -442,7 +325,7 @@ const Constructor = index_1.Runtime.Tuple([
442
325
  index_1.Runtime.Const(RParen),
443
326
  index_1.Runtime.Const('=>'),
444
327
  index_1.Runtime.Ref('Type')
445
- ], value => Types.Constructor(value[2], value[5]));
328
+ ], value => t.Constructor(value[2], value[5]));
446
329
  // ------------------------------------------------------------------
447
330
  // Function
448
331
  // ------------------------------------------------------------------
@@ -453,13 +336,13 @@ const Function = index_1.Runtime.Tuple([
453
336
  index_1.Runtime.Const(RParen),
454
337
  index_1.Runtime.Const('=>'),
455
338
  index_1.Runtime.Ref('Type')
456
- ], value => Types.Function(value[1], value[4]));
339
+ ], value => t.Function(value[1], value[4]));
457
340
  // ------------------------------------------------------------------
458
341
  // Mapped (requires deferred types)
459
342
  // ------------------------------------------------------------------
460
343
  // prettier-ignore
461
344
  const MappedMapping = (values) => {
462
- return Types.Literal('Mapped types not supported');
345
+ return t.Literal('Mapped types not supported');
463
346
  };
464
347
  // prettier-ignore
465
348
  const Mapped = index_1.Runtime.Tuple([
@@ -482,7 +365,7 @@ const AsyncIterator = index_1.Runtime.Tuple([
482
365
  index_1.Runtime.Const(LAngle),
483
366
  index_1.Runtime.Ref('Type'),
484
367
  index_1.Runtime.Const(RAngle),
485
- ], value => Types.AsyncIterator(value[2]));
368
+ ], value => t.AsyncIterator(value[2]));
486
369
  // ------------------------------------------------------------------
487
370
  // Iterator
488
371
  // ------------------------------------------------------------------
@@ -492,7 +375,7 @@ const Iterator = index_1.Runtime.Tuple([
492
375
  index_1.Runtime.Const(LAngle),
493
376
  index_1.Runtime.Ref('Type'),
494
377
  index_1.Runtime.Const(RAngle),
495
- ], value => Types.Iterator(value[2]));
378
+ ], value => t.Iterator(value[2]));
496
379
  // ------------------------------------------------------------------
497
380
  // ConstructorParameters
498
381
  // ------------------------------------------------------------------
@@ -502,7 +385,7 @@ const ConstructorParameters = index_1.Runtime.Tuple([
502
385
  index_1.Runtime.Const(LAngle),
503
386
  index_1.Runtime.Ref('Type'),
504
387
  index_1.Runtime.Const(RAngle),
505
- ], value => Types.ConstructorParameters(value[2]));
388
+ ], value => t.ConstructorParameters(value[2]));
506
389
  // ------------------------------------------------------------------
507
390
  // Parameters
508
391
  // ------------------------------------------------------------------
@@ -512,7 +395,7 @@ const FunctionParameters = index_1.Runtime.Tuple([
512
395
  index_1.Runtime.Const(LAngle),
513
396
  index_1.Runtime.Ref('Type'),
514
397
  index_1.Runtime.Const(RAngle),
515
- ], value => Types.Parameters(value[2]));
398
+ ], value => t.Parameters(value[2]));
516
399
  // ------------------------------------------------------------------
517
400
  // InstanceType
518
401
  // ------------------------------------------------------------------
@@ -522,7 +405,7 @@ const InstanceType = index_1.Runtime.Tuple([
522
405
  index_1.Runtime.Const(LAngle),
523
406
  index_1.Runtime.Ref('Type'),
524
407
  index_1.Runtime.Const(RAngle),
525
- ], value => Types.InstanceType(value[2]));
408
+ ], value => t.InstanceType(value[2]));
526
409
  // ------------------------------------------------------------------
527
410
  // ReturnType
528
411
  // ------------------------------------------------------------------
@@ -532,7 +415,7 @@ const ReturnType = index_1.Runtime.Tuple([
532
415
  index_1.Runtime.Const(LAngle),
533
416
  index_1.Runtime.Ref('Type'),
534
417
  index_1.Runtime.Const(RAngle),
535
- ], value => Types.ReturnType(value[2]));
418
+ ], value => t.ReturnType(value[2]));
536
419
  // ------------------------------------------------------------------
537
420
  // Awaited
538
421
  // ------------------------------------------------------------------
@@ -542,7 +425,7 @@ const Awaited = index_1.Runtime.Tuple([
542
425
  index_1.Runtime.Const(LAngle),
543
426
  index_1.Runtime.Ref('Type'),
544
427
  index_1.Runtime.Const(RAngle),
545
- ], value => Types.Awaited(value[2]));
428
+ ], value => t.Awaited(value[2]));
546
429
  // ------------------------------------------------------------------
547
430
  // Array
548
431
  // ------------------------------------------------------------------
@@ -552,7 +435,7 @@ const Array = index_1.Runtime.Tuple([
552
435
  index_1.Runtime.Const(LAngle),
553
436
  index_1.Runtime.Ref('Type'),
554
437
  index_1.Runtime.Const(RAngle),
555
- ], value => Types.Array(value[2]));
438
+ ], value => t.Array(value[2]));
556
439
  // ------------------------------------------------------------------
557
440
  // Record
558
441
  // ------------------------------------------------------------------
@@ -564,7 +447,7 @@ const Record = index_1.Runtime.Tuple([
564
447
  index_1.Runtime.Const(Comma),
565
448
  index_1.Runtime.Ref('Type'),
566
449
  index_1.Runtime.Const(RAngle),
567
- ], value => Types.Record(value[2], value[4]));
450
+ ], value => t.Record(value[2], value[4]));
568
451
  // ------------------------------------------------------------------
569
452
  // Promise
570
453
  // ------------------------------------------------------------------
@@ -574,7 +457,7 @@ const Promise = index_1.Runtime.Tuple([
574
457
  index_1.Runtime.Const(LAngle),
575
458
  index_1.Runtime.Ref('Type'),
576
459
  index_1.Runtime.Const(RAngle),
577
- ], value => Types.Promise(value[2]));
460
+ ], value => t.Promise(value[2]));
578
461
  // ------------------------------------------------------------------
579
462
  // Partial
580
463
  // ------------------------------------------------------------------
@@ -584,7 +467,7 @@ const Partial = index_1.Runtime.Tuple([
584
467
  index_1.Runtime.Const(LAngle),
585
468
  index_1.Runtime.Ref('Type'),
586
469
  index_1.Runtime.Const(RAngle),
587
- ], value => Types.Partial(value[2]));
470
+ ], value => t.Partial(value[2]));
588
471
  // ------------------------------------------------------------------
589
472
  // Required
590
473
  // ------------------------------------------------------------------
@@ -594,7 +477,7 @@ const Required = index_1.Runtime.Tuple([
594
477
  index_1.Runtime.Const(LAngle),
595
478
  index_1.Runtime.Ref('Type'),
596
479
  index_1.Runtime.Const(RAngle),
597
- ], value => Types.Required(value[2]));
480
+ ], value => t.Required(value[2]));
598
481
  // ------------------------------------------------------------------
599
482
  // Pick
600
483
  // ------------------------------------------------------------------
@@ -606,7 +489,7 @@ const Pick = index_1.Runtime.Tuple([
606
489
  index_1.Runtime.Const(Comma),
607
490
  index_1.Runtime.Ref('Type'),
608
491
  index_1.Runtime.Const(RAngle),
609
- ], value => Types.Pick(value[2], value[4]));
492
+ ], value => t.Pick(value[2], value[4]));
610
493
  // ------------------------------------------------------------------
611
494
  // Omit
612
495
  // ------------------------------------------------------------------
@@ -618,7 +501,7 @@ const Omit = index_1.Runtime.Tuple([
618
501
  index_1.Runtime.Const(Comma),
619
502
  index_1.Runtime.Ref('Type'),
620
503
  index_1.Runtime.Const(RAngle),
621
- ], value => Types.Omit(value[2], value[4]));
504
+ ], value => t.Omit(value[2], value[4]));
622
505
  // ------------------------------------------------------------------
623
506
  // Exclude
624
507
  // ------------------------------------------------------------------
@@ -630,7 +513,7 @@ const Exclude = index_1.Runtime.Tuple([
630
513
  index_1.Runtime.Const(Comma),
631
514
  index_1.Runtime.Ref('Type'),
632
515
  index_1.Runtime.Const(RAngle),
633
- ], value => Types.Exclude(value[2], value[4]));
516
+ ], value => t.Exclude(value[2], value[4]));
634
517
  // ------------------------------------------------------------------
635
518
  // Extract
636
519
  // ------------------------------------------------------------------
@@ -642,7 +525,7 @@ const Extract = index_1.Runtime.Tuple([
642
525
  index_1.Runtime.Const(Comma),
643
526
  index_1.Runtime.Ref('Type'),
644
527
  index_1.Runtime.Const(RAngle),
645
- ], value => Types.Extract(value[2], value[4]));
528
+ ], value => t.Extract(value[2], value[4]));
646
529
  // ------------------------------------------------------------------
647
530
  // Uppercase
648
531
  // ------------------------------------------------------------------
@@ -652,7 +535,7 @@ const Uppercase = index_1.Runtime.Tuple([
652
535
  index_1.Runtime.Const(LAngle),
653
536
  index_1.Runtime.Ref('Type'),
654
537
  index_1.Runtime.Const(RAngle),
655
- ], value => Types.Uppercase(value[2]));
538
+ ], value => t.Uppercase(value[2]));
656
539
  // ------------------------------------------------------------------
657
540
  // Lowercase
658
541
  // ------------------------------------------------------------------
@@ -662,7 +545,7 @@ const Lowercase = index_1.Runtime.Tuple([
662
545
  index_1.Runtime.Const(LAngle),
663
546
  index_1.Runtime.Ref('Type'),
664
547
  index_1.Runtime.Const(RAngle),
665
- ], value => Types.Lowercase(value[2]));
548
+ ], value => t.Lowercase(value[2]));
666
549
  // ------------------------------------------------------------------
667
550
  // Capitalize
668
551
  // ------------------------------------------------------------------
@@ -672,7 +555,7 @@ const Capitalize = index_1.Runtime.Tuple([
672
555
  index_1.Runtime.Const(LAngle),
673
556
  index_1.Runtime.Ref('Type'),
674
557
  index_1.Runtime.Const(RAngle),
675
- ], value => Types.Capitalize(value[2]));
558
+ ], value => t.Capitalize(value[2]));
676
559
  // ------------------------------------------------------------------
677
560
  // Uncapitalize
678
561
  // ------------------------------------------------------------------
@@ -682,41 +565,20 @@ const Uncapitalize = index_1.Runtime.Tuple([
682
565
  index_1.Runtime.Const(LAngle),
683
566
  index_1.Runtime.Ref('Type'),
684
567
  index_1.Runtime.Const(RAngle),
685
- ], value => Types.Uncapitalize(value[2]));
568
+ ], value => t.Uncapitalize(value[2]));
686
569
  // ------------------------------------------------------------------
687
570
  // Date
688
571
  // ------------------------------------------------------------------
689
- const Date = index_1.Runtime.Const('Date', index_1.Runtime.As(Types.Date()));
572
+ const Date = index_1.Runtime.Const('Date', index_1.Runtime.As(t.Date()));
690
573
  // ------------------------------------------------------------------
691
574
  // Uint8Array
692
575
  // ------------------------------------------------------------------
693
- const Uint8Array = index_1.Runtime.Const('Uint8Array', index_1.Runtime.As(Types.Uint8Array()));
694
- // ------------------------------------------------------------------
695
- // Main
696
- // ------------------------------------------------------------------
697
- // prettier-ignore
698
- const Main = index_1.Runtime.Union([
699
- ModuleDeclaration,
700
- TypeAliasDeclaration,
701
- InterfaceDeclaration,
702
- Type
703
- ]);
576
+ const Uint8Array = index_1.Runtime.Const('Uint8Array', index_1.Runtime.As(t.Uint8Array()));
704
577
  // ------------------------------------------------------------------
705
578
  // Module
706
579
  // ------------------------------------------------------------------
707
580
  // prettier-ignore
708
581
  exports.Module = new index_1.Runtime.Module({
709
- // ----------------------------------------------------------------
710
- // Modules, Interfaces and Type Aliases
711
- // ----------------------------------------------------------------
712
- ExportModifier,
713
- HeritageList,
714
- Heritage,
715
- InterfaceDeclaration,
716
- TypeAliasDeclaration,
717
- ModuleType,
718
- ModuleProperties,
719
- ModuleDeclaration,
720
582
  // ----------------------------------------------------------------
721
583
  // Type Expressions
722
584
  // ----------------------------------------------------------------
@@ -769,8 +631,4 @@ exports.Module = new index_1.Runtime.Module({
769
631
  Date,
770
632
  Uint8Array,
771
633
  Reference,
772
- // ----------------------------------------------------------------
773
- // Main
774
- // ----------------------------------------------------------------
775
- Main
776
634
  });