@sinclair/typebox 0.33.18 → 0.33.20

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 (71) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +5 -1
  3. package/build/cjs/parse/index.d.ts +1 -0
  4. package/build/cjs/parse/index.js +18 -0
  5. package/build/cjs/parse/parse.d.ts +11 -0
  6. package/build/cjs/parse/parse.js +18 -0
  7. package/build/cjs/parse/parsebox/index.d.ts +2 -0
  8. package/build/cjs/parse/parsebox/index.js +6 -0
  9. package/build/cjs/parse/parsebox/runtime/guard.d.ts +17 -0
  10. package/build/cjs/parse/parsebox/runtime/guard.js +75 -0
  11. package/build/cjs/parse/parsebox/runtime/index.d.ts +5 -0
  12. package/build/cjs/parse/parsebox/runtime/index.js +23 -0
  13. package/build/cjs/parse/parsebox/runtime/module.d.ts +9 -0
  14. package/build/cjs/parse/parsebox/runtime/module.js +22 -0
  15. package/build/cjs/parse/parsebox/runtime/parse.d.ts +9 -0
  16. package/build/cjs/parse/parsebox/runtime/parse.js +99 -0
  17. package/build/cjs/parse/parsebox/runtime/token.d.ts +8 -0
  18. package/build/cjs/parse/parsebox/runtime/token.js +230 -0
  19. package/build/cjs/parse/parsebox/runtime/types.d.ts +68 -0
  20. package/build/cjs/parse/parsebox/runtime/types.js +45 -0
  21. package/build/cjs/parse/parsebox/static/index.d.ts +3 -0
  22. package/build/cjs/parse/parsebox/static/index.js +21 -0
  23. package/build/cjs/parse/parsebox/static/parse.d.ts +17 -0
  24. package/build/cjs/parse/parsebox/static/parse.js +3 -0
  25. package/build/cjs/parse/parsebox/static/token.d.ts +108 -0
  26. package/build/cjs/parse/parsebox/static/token.js +3 -0
  27. package/build/cjs/parse/parsebox/static/types.d.ts +46 -0
  28. package/build/cjs/parse/parsebox/static/types.js +3 -0
  29. package/build/cjs/parse/runtime.d.ts +55 -0
  30. package/build/cjs/parse/runtime.js +621 -0
  31. package/build/cjs/parse/static.d.ts +471 -0
  32. package/build/cjs/parse/static.js +3 -0
  33. package/build/cjs/type/create/immutable.d.ts +1 -1
  34. package/build/cjs/type/create/immutable.js +7 -11
  35. package/build/esm/index.d.mts +1 -0
  36. package/build/esm/index.mjs +5 -1
  37. package/build/esm/parse/index.d.mts +1 -0
  38. package/build/esm/parse/index.mjs +1 -0
  39. package/build/esm/parse/parse.d.mts +11 -0
  40. package/build/esm/parse/parse.mjs +13 -0
  41. package/build/esm/parse/parsebox/index.d.mts +2 -0
  42. package/build/esm/parse/parsebox/index.mjs +2 -0
  43. package/build/esm/parse/parsebox/runtime/guard.d.mts +17 -0
  44. package/build/esm/parse/parsebox/runtime/guard.mjs +64 -0
  45. package/build/esm/parse/parsebox/runtime/index.d.mts +5 -0
  46. package/build/esm/parse/parsebox/runtime/index.mjs +5 -0
  47. package/build/esm/parse/parsebox/runtime/module.d.mts +9 -0
  48. package/build/esm/parse/parsebox/runtime/module.mjs +17 -0
  49. package/build/esm/parse/parsebox/runtime/parse.d.mts +9 -0
  50. package/build/esm/parse/parsebox/runtime/parse.mjs +95 -0
  51. package/build/esm/parse/parsebox/runtime/token.d.mts +8 -0
  52. package/build/esm/parse/parsebox/runtime/token.mjs +223 -0
  53. package/build/esm/parse/parsebox/runtime/types.d.mts +68 -0
  54. package/build/esm/parse/parsebox/runtime/types.mjs +32 -0
  55. package/build/esm/parse/parsebox/static/index.d.mts +3 -0
  56. package/build/esm/parse/parsebox/static/index.mjs +3 -0
  57. package/build/esm/parse/parsebox/static/parse.d.mts +17 -0
  58. package/build/esm/parse/parsebox/static/parse.mjs +1 -0
  59. package/build/esm/parse/parsebox/static/token.d.mts +108 -0
  60. package/build/esm/parse/parsebox/static/token.mjs +1 -0
  61. package/build/esm/parse/parsebox/static/types.d.mts +46 -0
  62. package/build/esm/parse/parsebox/static/types.mjs +1 -0
  63. package/build/esm/parse/runtime.d.mts +55 -0
  64. package/build/esm/parse/runtime.mjs +617 -0
  65. package/build/esm/parse/static.d.mts +471 -0
  66. package/build/esm/parse/static.mjs +1 -0
  67. package/build/esm/type/create/immutable.d.mts +1 -1
  68. package/build/esm/type/create/immutable.mjs +7 -11
  69. package/package.json +11 -1
  70. package/parse/package.json +4 -0
  71. package/readme.md +5 -4
@@ -0,0 +1,621 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Module = void 0;
5
+ const index_1 = require("./parsebox/index");
6
+ const Types = require("../type/index");
7
+ // ------------------------------------------------------------------
8
+ // Tokens
9
+ // ------------------------------------------------------------------
10
+ const Newline = '\n';
11
+ const LBracket = '[';
12
+ const RBracket = ']';
13
+ const LParen = '(';
14
+ const RParen = ')';
15
+ const LBrace = '{';
16
+ const RBrace = '}';
17
+ const LAngle = '<';
18
+ const RAngle = '>';
19
+ const Question = '?';
20
+ const Colon = ':';
21
+ const Comma = ',';
22
+ const SemiColon = ';';
23
+ const SingleQuote = "'";
24
+ const DoubleQuote = '"';
25
+ const Tilde = '`';
26
+ // ------------------------------------------------------------------
27
+ // DestructureRight
28
+ // ------------------------------------------------------------------
29
+ // prettier-ignore
30
+ function DestructureRight(values) {
31
+ return (values.length > 0)
32
+ ? [values.slice(0, values.length - 1), values[values.length - 1]]
33
+ : [values, undefined];
34
+ }
35
+ // ------------------------------------------------------------------
36
+ // Reference
37
+ // ------------------------------------------------------------------
38
+ // prettier-ignore
39
+ const Reference = index_1.Runtime.Ident((value, context) => {
40
+ return value in context ? context[value] : Types.Ref(value);
41
+ });
42
+ // ------------------------------------------------------------------
43
+ // Literal
44
+ // ------------------------------------------------------------------
45
+ // prettier-ignore
46
+ const Literal = index_1.Runtime.Union([
47
+ index_1.Runtime.Union([index_1.Runtime.Const('true'), index_1.Runtime.Const('false')], value => Types.Literal(value === 'true')),
48
+ index_1.Runtime.Number(value => Types.Literal(parseFloat(value))),
49
+ index_1.Runtime.String([SingleQuote, DoubleQuote, Tilde], value => Types.Literal(value))
50
+ ]);
51
+ // ------------------------------------------------------------------
52
+ // Keyword
53
+ // ------------------------------------------------------------------
54
+ // prettier-ignore
55
+ const Keyword = index_1.Runtime.Union([
56
+ index_1.Runtime.Const('any', index_1.Runtime.As(Types.Any())),
57
+ index_1.Runtime.Const('bigint', index_1.Runtime.As(Types.BigInt())),
58
+ index_1.Runtime.Const('boolean', index_1.Runtime.As(Types.Boolean())),
59
+ index_1.Runtime.Const('integer', index_1.Runtime.As(Types.Integer())),
60
+ index_1.Runtime.Const('never', index_1.Runtime.As(Types.Never())),
61
+ index_1.Runtime.Const('null', index_1.Runtime.As(Types.Null())),
62
+ index_1.Runtime.Const('number', index_1.Runtime.As(Types.Number())),
63
+ index_1.Runtime.Const('string', index_1.Runtime.As(Types.String())),
64
+ index_1.Runtime.Const('symbol', index_1.Runtime.As(Types.Symbol())),
65
+ index_1.Runtime.Const('undefined', index_1.Runtime.As(Types.Undefined())),
66
+ index_1.Runtime.Const('unknown', index_1.Runtime.As(Types.Unknown())),
67
+ index_1.Runtime.Const('void', index_1.Runtime.As(Types.Void())),
68
+ ]);
69
+ // ------------------------------------------------------------------
70
+ // KeyOf
71
+ // ------------------------------------------------------------------
72
+ // prettier-ignore
73
+ const KeyOfMapping = (values) => (values.length > 0);
74
+ // prettier-ignore
75
+ const KeyOf = index_1.Runtime.Union([
76
+ index_1.Runtime.Tuple([index_1.Runtime.Const('keyof')]), index_1.Runtime.Tuple([])
77
+ ], KeyOfMapping);
78
+ // ------------------------------------------------------------------
79
+ // IndexArray
80
+ // ------------------------------------------------------------------
81
+ // prettier-ignore
82
+ const IndexArrayMapping = (values) => (values.length === 4 ? [[values[1]], ...values[3]] :
83
+ values.length === 3 ? [[], ...values[2]] :
84
+ []);
85
+ // prettier-ignore
86
+ const IndexArray = index_1.Runtime.Union([
87
+ index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RBracket), index_1.Runtime.Ref('IndexArray')]),
88
+ index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Const(RBracket), index_1.Runtime.Ref('IndexArray')]),
89
+ index_1.Runtime.Tuple([])
90
+ ], value => IndexArrayMapping(value));
91
+ // ------------------------------------------------------------------
92
+ // Extends
93
+ // ------------------------------------------------------------------
94
+ // prettier-ignore
95
+ const ExtendsMapping = (values) => {
96
+ return values.length === 6
97
+ ? [values[1], values[3], values[5]]
98
+ : [];
99
+ };
100
+ // prettier-ignore
101
+ const Extends = index_1.Runtime.Union([
102
+ index_1.Runtime.Tuple([index_1.Runtime.Const('extends'), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Question), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Colon), index_1.Runtime.Ref('Type')]),
103
+ index_1.Runtime.Tuple([])
104
+ ], ExtendsMapping);
105
+ // ------------------------------------------------------------------
106
+ // Base
107
+ // ------------------------------------------------------------------
108
+ // prettier-ignore
109
+ const BaseMapping = (values) => {
110
+ return values.length === 3 ? values[1] : values[0];
111
+ };
112
+ // prettier-ignore
113
+ const Base = index_1.Runtime.Union([
114
+ index_1.Runtime.Tuple([
115
+ index_1.Runtime.Const(LParen),
116
+ index_1.Runtime.Ref('Type'),
117
+ index_1.Runtime.Const(RParen)
118
+ ]),
119
+ index_1.Runtime.Tuple([index_1.Runtime.Union([
120
+ index_1.Runtime.Ref('Literal'),
121
+ index_1.Runtime.Ref('Keyword'),
122
+ index_1.Runtime.Ref('Object'),
123
+ index_1.Runtime.Ref('Tuple'),
124
+ index_1.Runtime.Ref('Constructor'),
125
+ index_1.Runtime.Ref('Function'),
126
+ index_1.Runtime.Ref('Mapped'),
127
+ index_1.Runtime.Ref('AsyncIterator'),
128
+ index_1.Runtime.Ref('Iterator'),
129
+ index_1.Runtime.Ref('ConstructorParameters'),
130
+ index_1.Runtime.Ref('FunctionParameters'),
131
+ index_1.Runtime.Ref('InstanceType'),
132
+ index_1.Runtime.Ref('ReturnType'),
133
+ index_1.Runtime.Ref('Awaited'),
134
+ index_1.Runtime.Ref('Array'),
135
+ index_1.Runtime.Ref('Record'),
136
+ index_1.Runtime.Ref('Promise'),
137
+ index_1.Runtime.Ref('Partial'),
138
+ index_1.Runtime.Ref('Required'),
139
+ index_1.Runtime.Ref('Pick'),
140
+ index_1.Runtime.Ref('Omit'),
141
+ index_1.Runtime.Ref('Exclude'),
142
+ index_1.Runtime.Ref('Extract'),
143
+ index_1.Runtime.Ref('Uppercase'),
144
+ index_1.Runtime.Ref('Lowercase'),
145
+ index_1.Runtime.Ref('Capitalize'),
146
+ index_1.Runtime.Ref('Uncapitalize'),
147
+ index_1.Runtime.Ref('Date'),
148
+ index_1.Runtime.Ref('Uint8Array'),
149
+ index_1.Runtime.Ref('Reference')
150
+ ])])
151
+ ], BaseMapping);
152
+ // ------------------------------------------------------------------
153
+ // Factor
154
+ // ------------------------------------------------------------------
155
+ // prettier-ignore
156
+ const FactorExtends = (Type, Extends) => {
157
+ return Extends.length === 3
158
+ ? Types.Extends(Type, Extends[0], Extends[1], Extends[2])
159
+ : Type;
160
+ };
161
+ // prettier-ignore
162
+ const FactorIndexArray = (Type, IndexArray) => {
163
+ const [Left, Right] = DestructureRight(IndexArray);
164
+ return (!Types.ValueGuard.IsUndefined(Right) ? (Right.length === 1 ? Types.Index(FactorIndexArray(Type, Left), Right[0]) :
165
+ Right.length === 0 ? Types.Array(FactorIndexArray(Type, Left)) :
166
+ Types.Never()) : Type);
167
+ };
168
+ // prettier-ignore
169
+ const FactorMapping = (KeyOf, Type, IndexArray, Extends) => {
170
+ return KeyOf
171
+ ? FactorExtends(Types.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
172
+ : FactorExtends(FactorIndexArray(Type, IndexArray), Extends);
173
+ };
174
+ // prettier-ignore
175
+ const Factor = index_1.Runtime.Tuple([
176
+ index_1.Runtime.Ref('KeyOf'),
177
+ index_1.Runtime.Ref('Base'),
178
+ index_1.Runtime.Ref('IndexArray'),
179
+ index_1.Runtime.Ref('Extends')
180
+ ], values => FactorMapping(...values));
181
+ // ------------------------------------------------------------------
182
+ // Expr
183
+ // ------------------------------------------------------------------
184
+ // prettier-ignore
185
+ function ExprBinaryMapping(Left, Rest) {
186
+ return (Rest.length === 3 ? (() => {
187
+ const [Operator, Right, Next] = Rest;
188
+ const Schema = ExprBinaryMapping(Right, Next);
189
+ if (Operator === '&') {
190
+ return Types.TypeGuard.IsIntersect(Schema)
191
+ ? Types.Intersect([Left, ...Schema.allOf])
192
+ : Types.Intersect([Left, Schema]);
193
+ }
194
+ if (Operator === '|') {
195
+ return Types.TypeGuard.IsUnion(Schema)
196
+ ? Types.Union([Left, ...Schema.anyOf])
197
+ : Types.Union([Left, Schema]);
198
+ }
199
+ throw 1;
200
+ })() : Left);
201
+ }
202
+ // prettier-ignore
203
+ const ExprTermTail = index_1.Runtime.Union([
204
+ index_1.Runtime.Tuple([index_1.Runtime.Const('&'), index_1.Runtime.Ref('Factor'), index_1.Runtime.Ref('ExprTermTail')]),
205
+ index_1.Runtime.Tuple([])
206
+ ]);
207
+ // prettier-ignore
208
+ const ExprTerm = index_1.Runtime.Tuple([
209
+ index_1.Runtime.Ref('Factor'), index_1.Runtime.Ref('ExprTermTail')
210
+ ], value => ExprBinaryMapping(...value));
211
+ // prettier-ignore
212
+ const ExprTail = index_1.Runtime.Union([
213
+ index_1.Runtime.Tuple([index_1.Runtime.Const('|'), index_1.Runtime.Ref('ExprTerm'), index_1.Runtime.Ref('ExprTail')]),
214
+ index_1.Runtime.Tuple([])
215
+ ]);
216
+ // prettier-ignore
217
+ const Expr = index_1.Runtime.Tuple([
218
+ index_1.Runtime.Ref('ExprTerm'), index_1.Runtime.Ref('ExprTail')
219
+ ], value => ExprBinaryMapping(...value));
220
+ // ------------------------------------------------------------------
221
+ // Type
222
+ // ------------------------------------------------------------------
223
+ const Type = index_1.Runtime.Ref('Expr');
224
+ // ------------------------------------------------------------------
225
+ // Properties
226
+ // ------------------------------------------------------------------
227
+ // prettier-ignore
228
+ const PropertyKey = index_1.Runtime.Union([index_1.Runtime.Ident(), index_1.Runtime.String([SingleQuote, DoubleQuote])]);
229
+ // prettier-ignore
230
+ const PropertyReadonly = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.Const('readonly')]), index_1.Runtime.Tuple([])], value => value.length > 0);
231
+ // prettier-ignore
232
+ const PropertyOptional = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.Const(Question)]), index_1.Runtime.Tuple([])], value => value.length > 0);
233
+ // prettier-ignore
234
+ const PropertyMapping = (Readonly, Key, Optional, _, Type) => ({
235
+ [Key]: (Readonly && Optional ? Types.ReadonlyOptional(Type) :
236
+ Readonly && !Optional ? Types.Readonly(Type) :
237
+ !Readonly && Optional ? Types.Optional(Type) :
238
+ Type)
239
+ });
240
+ // prettier-ignore
241
+ const Property = index_1.Runtime.Tuple([
242
+ index_1.Runtime.Ref('PropertyReadonly'),
243
+ index_1.Runtime.Ref('PropertyKey'),
244
+ index_1.Runtime.Ref('PropertyOptional'),
245
+ index_1.Runtime.Const(Colon),
246
+ index_1.Runtime.Ref('Type'),
247
+ ], value => PropertyMapping(...value));
248
+ // prettier-ignore
249
+ const PropertyDelimiter = index_1.Runtime.Union([
250
+ index_1.Runtime.Tuple([index_1.Runtime.Const(Comma), index_1.Runtime.Const(Newline)]),
251
+ index_1.Runtime.Tuple([index_1.Runtime.Const(SemiColon), index_1.Runtime.Const(Newline)]),
252
+ index_1.Runtime.Tuple([index_1.Runtime.Const(Comma)]),
253
+ index_1.Runtime.Tuple([index_1.Runtime.Const(SemiColon)]),
254
+ index_1.Runtime.Tuple([index_1.Runtime.Const(Newline)]),
255
+ ]);
256
+ // prettier-ignore
257
+ const Properties = index_1.Runtime.Union([
258
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Property'), index_1.Runtime.Ref('PropertyDelimiter'), index_1.Runtime.Ref('Properties')]),
259
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Property'), index_1.Runtime.Ref('PropertyDelimiter')]),
260
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Property')]),
261
+ index_1.Runtime.Tuple([])
262
+ ], values => (values.length === 3 ? [values[0], ...values[2]] :
263
+ values.length === 2 ? [values[0]] :
264
+ values.length === 1 ? [values[0]] :
265
+ []));
266
+ // ------------------------------------------------------------------
267
+ // Object
268
+ // ------------------------------------------------------------------
269
+ // prettier-ignore
270
+ const ObjectMapping = (values) => Types.Object(values.reduce((properties, record) => {
271
+ return { ...properties, ...record };
272
+ }, {}));
273
+ // prettier-ignore
274
+ const Object = index_1.Runtime.Tuple([
275
+ index_1.Runtime.Const(LBrace),
276
+ index_1.Runtime.Ref('Properties'),
277
+ index_1.Runtime.Const(RBrace)
278
+ ], values => ObjectMapping(values[1]));
279
+ // ------------------------------------------------------------------
280
+ // Tuple
281
+ // ------------------------------------------------------------------
282
+ // prettier-ignore
283
+ const Elements = index_1.Runtime.Union([
284
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma), index_1.Runtime.Ref('Elements')]),
285
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma)]),
286
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Type')]),
287
+ index_1.Runtime.Tuple([]),
288
+ ], value => (value.length === 3 ? [value[0], ...value[2]] :
289
+ value.length === 2 ? [value[0]] :
290
+ value.length === 1 ? [value[0]] :
291
+ []));
292
+ // prettier-ignore
293
+ const Tuple = index_1.Runtime.Tuple([
294
+ index_1.Runtime.Const(LBracket),
295
+ index_1.Runtime.Ref('Elements'),
296
+ index_1.Runtime.Const(RBracket)
297
+ ], value => Types.Tuple(value[1]));
298
+ // ------------------------------------------------------------------
299
+ // Parameters
300
+ // ------------------------------------------------------------------
301
+ // prettier-ignore
302
+ const Parameter = index_1.Runtime.Tuple([
303
+ index_1.Runtime.Ident(), index_1.Runtime.Const(Colon), index_1.Runtime.Ref('Type')
304
+ ], value => value[2]);
305
+ // prettier-ignore
306
+ const Parameters = index_1.Runtime.Union([
307
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Parameter'), index_1.Runtime.Const(Comma), index_1.Runtime.Ref('Parameters')]),
308
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Parameter'), index_1.Runtime.Const(Comma)]),
309
+ index_1.Runtime.Tuple([index_1.Runtime.Ref('Parameter')]),
310
+ index_1.Runtime.Tuple([]),
311
+ ], value => (value.length === 3 ? [value[0], ...value[2]] :
312
+ value.length === 2 ? [value[0]] :
313
+ value.length === 1 ? [value[0]] :
314
+ []));
315
+ // ------------------------------------------------------------------
316
+ // Constructor
317
+ // ------------------------------------------------------------------
318
+ // prettier-ignore
319
+ const Constructor = index_1.Runtime.Tuple([
320
+ index_1.Runtime.Const('new'),
321
+ index_1.Runtime.Const(LParen),
322
+ index_1.Runtime.Ref('Parameters'),
323
+ index_1.Runtime.Const(RParen),
324
+ index_1.Runtime.Const('=>'),
325
+ index_1.Runtime.Ref('Type')
326
+ ], value => Types.Constructor(value[2], value[5]));
327
+ // ------------------------------------------------------------------
328
+ // Function
329
+ // ------------------------------------------------------------------
330
+ // prettier-ignore
331
+ const Function = index_1.Runtime.Tuple([
332
+ index_1.Runtime.Const(LParen),
333
+ index_1.Runtime.Ref('Parameters'),
334
+ index_1.Runtime.Const(RParen),
335
+ index_1.Runtime.Const('=>'),
336
+ index_1.Runtime.Ref('Type')
337
+ ], value => Types.Function(value[1], value[4]));
338
+ // ------------------------------------------------------------------
339
+ // Mapped (requires deferred types)
340
+ // ------------------------------------------------------------------
341
+ // prettier-ignore
342
+ const MappedMapping = (values) => {
343
+ return Types.Literal('Mapped types not supported');
344
+ };
345
+ // prettier-ignore
346
+ const Mapped = index_1.Runtime.Tuple([
347
+ index_1.Runtime.Const(LBrace), index_1.Runtime.Const(LBracket), index_1.Runtime.Ident(), index_1.Runtime.Const('in'), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RBracket), index_1.Runtime.Const(Colon), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RBrace)
348
+ ], MappedMapping);
349
+ // ------------------------------------------------------------------
350
+ // AsyncIterator
351
+ // ------------------------------------------------------------------
352
+ // prettier-ignore
353
+ const AsyncIterator = index_1.Runtime.Tuple([
354
+ index_1.Runtime.Const('AsyncIterator'),
355
+ index_1.Runtime.Const(LAngle),
356
+ index_1.Runtime.Ref('Type'),
357
+ index_1.Runtime.Const(RAngle),
358
+ ], value => Types.AsyncIterator(value[2]));
359
+ // ------------------------------------------------------------------
360
+ // Iterator
361
+ // ------------------------------------------------------------------
362
+ // prettier-ignore
363
+ const Iterator = index_1.Runtime.Tuple([
364
+ index_1.Runtime.Const('Iterator'),
365
+ index_1.Runtime.Const(LAngle),
366
+ index_1.Runtime.Ref('Type'),
367
+ index_1.Runtime.Const(RAngle),
368
+ ], value => Types.Iterator(value[2]));
369
+ // ------------------------------------------------------------------
370
+ // ConstructorParameters
371
+ // ------------------------------------------------------------------
372
+ // prettier-ignore
373
+ const ConstructorParameters = index_1.Runtime.Tuple([
374
+ index_1.Runtime.Const('ConstructorParameters'),
375
+ index_1.Runtime.Const(LAngle),
376
+ index_1.Runtime.Ref('Type'),
377
+ index_1.Runtime.Const(RAngle),
378
+ ], value => Types.ConstructorParameters(value[2]));
379
+ // ------------------------------------------------------------------
380
+ // Parameters
381
+ // ------------------------------------------------------------------
382
+ // prettier-ignore
383
+ const FunctionParameters = index_1.Runtime.Tuple([
384
+ index_1.Runtime.Const('Parameters'),
385
+ index_1.Runtime.Const(LAngle),
386
+ index_1.Runtime.Ref('Type'),
387
+ index_1.Runtime.Const(RAngle),
388
+ ], value => Types.Parameters(value[2]));
389
+ // ------------------------------------------------------------------
390
+ // InstanceType
391
+ // ------------------------------------------------------------------
392
+ // prettier-ignore
393
+ const InstanceType = index_1.Runtime.Tuple([
394
+ index_1.Runtime.Const('InstanceType'),
395
+ index_1.Runtime.Const(LAngle),
396
+ index_1.Runtime.Ref('Type'),
397
+ index_1.Runtime.Const(RAngle),
398
+ ], value => Types.InstanceType(value[2]));
399
+ // ------------------------------------------------------------------
400
+ // ReturnType
401
+ // ------------------------------------------------------------------
402
+ // prettier-ignore
403
+ const ReturnType = index_1.Runtime.Tuple([
404
+ index_1.Runtime.Const('ReturnType'),
405
+ index_1.Runtime.Const(LAngle),
406
+ index_1.Runtime.Ref('Type'),
407
+ index_1.Runtime.Const(RAngle),
408
+ ], value => Types.ReturnType(value[2]));
409
+ // ------------------------------------------------------------------
410
+ // Awaited
411
+ // ------------------------------------------------------------------
412
+ // prettier-ignore
413
+ const Awaited = index_1.Runtime.Tuple([
414
+ index_1.Runtime.Const('Awaited'),
415
+ index_1.Runtime.Const(LAngle),
416
+ index_1.Runtime.Ref('Type'),
417
+ index_1.Runtime.Const(RAngle),
418
+ ], value => Types.Awaited(value[2]));
419
+ // ------------------------------------------------------------------
420
+ // Array
421
+ // ------------------------------------------------------------------
422
+ // prettier-ignore
423
+ const Array = index_1.Runtime.Tuple([
424
+ index_1.Runtime.Const('Array'),
425
+ index_1.Runtime.Const(LAngle),
426
+ index_1.Runtime.Ref('Type'),
427
+ index_1.Runtime.Const(RAngle),
428
+ ], value => Types.Array(value[2]));
429
+ // ------------------------------------------------------------------
430
+ // Record
431
+ // ------------------------------------------------------------------
432
+ // prettier-ignore
433
+ const Record = index_1.Runtime.Tuple([
434
+ index_1.Runtime.Const('Record'),
435
+ index_1.Runtime.Const(LAngle),
436
+ index_1.Runtime.Ref('Type'),
437
+ index_1.Runtime.Const(Comma),
438
+ index_1.Runtime.Ref('Type'),
439
+ index_1.Runtime.Const(RAngle),
440
+ ], value => Types.Record(value[2], value[4]));
441
+ // ------------------------------------------------------------------
442
+ // Promise
443
+ // ------------------------------------------------------------------
444
+ // prettier-ignore
445
+ const Promise = index_1.Runtime.Tuple([
446
+ index_1.Runtime.Const('Promise'),
447
+ index_1.Runtime.Const(LAngle),
448
+ index_1.Runtime.Ref('Type'),
449
+ index_1.Runtime.Const(RAngle),
450
+ ], value => Types.Promise(value[2]));
451
+ // ------------------------------------------------------------------
452
+ // Partial
453
+ // ------------------------------------------------------------------
454
+ // prettier-ignore
455
+ const Partial = index_1.Runtime.Tuple([
456
+ index_1.Runtime.Const('Partial'),
457
+ index_1.Runtime.Const(LAngle),
458
+ index_1.Runtime.Ref('Type'),
459
+ index_1.Runtime.Const(RAngle),
460
+ ], value => Types.Partial(value[2]));
461
+ // ------------------------------------------------------------------
462
+ // Required
463
+ // ------------------------------------------------------------------
464
+ // prettier-ignore
465
+ const Required = index_1.Runtime.Tuple([
466
+ index_1.Runtime.Const('Required'),
467
+ index_1.Runtime.Const(LAngle),
468
+ index_1.Runtime.Ref('Type'),
469
+ index_1.Runtime.Const(RAngle),
470
+ ], value => Types.Required(value[2]));
471
+ // ------------------------------------------------------------------
472
+ // Pick
473
+ // ------------------------------------------------------------------
474
+ // prettier-ignore
475
+ const Pick = index_1.Runtime.Tuple([
476
+ index_1.Runtime.Const('Pick'),
477
+ index_1.Runtime.Const(LAngle),
478
+ index_1.Runtime.Ref('Type'),
479
+ index_1.Runtime.Const(Comma),
480
+ index_1.Runtime.Ref('Type'),
481
+ index_1.Runtime.Const(RAngle),
482
+ ], value => Types.Pick(value[2], value[4]));
483
+ // ------------------------------------------------------------------
484
+ // Omit
485
+ // ------------------------------------------------------------------
486
+ // prettier-ignore
487
+ const Omit = index_1.Runtime.Tuple([
488
+ index_1.Runtime.Const('Omit'),
489
+ index_1.Runtime.Const(LAngle),
490
+ index_1.Runtime.Ref('Type'),
491
+ index_1.Runtime.Const(Comma),
492
+ index_1.Runtime.Ref('Type'),
493
+ index_1.Runtime.Const(RAngle),
494
+ ], value => Types.Omit(value[2], value[4]));
495
+ // ------------------------------------------------------------------
496
+ // Exclude
497
+ // ------------------------------------------------------------------
498
+ // prettier-ignore
499
+ const Exclude = index_1.Runtime.Tuple([
500
+ index_1.Runtime.Const('Exclude'),
501
+ index_1.Runtime.Const(LAngle),
502
+ index_1.Runtime.Ref('Type'),
503
+ index_1.Runtime.Const(Comma),
504
+ index_1.Runtime.Ref('Type'),
505
+ index_1.Runtime.Const(RAngle),
506
+ ], value => Types.Exclude(value[2], value[4]));
507
+ // ------------------------------------------------------------------
508
+ // Extract
509
+ // ------------------------------------------------------------------
510
+ // prettier-ignore
511
+ const Extract = index_1.Runtime.Tuple([
512
+ index_1.Runtime.Const('Extract'),
513
+ index_1.Runtime.Const(LAngle),
514
+ index_1.Runtime.Ref('Type'),
515
+ index_1.Runtime.Const(Comma),
516
+ index_1.Runtime.Ref('Type'),
517
+ index_1.Runtime.Const(RAngle),
518
+ ], value => Types.Extract(value[2], value[4]));
519
+ // ------------------------------------------------------------------
520
+ // Uppercase
521
+ // ------------------------------------------------------------------
522
+ // prettier-ignore
523
+ const Uppercase = index_1.Runtime.Tuple([
524
+ index_1.Runtime.Const('Uppercase'),
525
+ index_1.Runtime.Const(LAngle),
526
+ index_1.Runtime.Ref('Type'),
527
+ index_1.Runtime.Const(RAngle),
528
+ ], value => Types.Uppercase(value[2]));
529
+ // ------------------------------------------------------------------
530
+ // Lowercase
531
+ // ------------------------------------------------------------------
532
+ // prettier-ignore
533
+ const Lowercase = index_1.Runtime.Tuple([
534
+ index_1.Runtime.Const('Lowercase'),
535
+ index_1.Runtime.Const(LAngle),
536
+ index_1.Runtime.Ref('Type'),
537
+ index_1.Runtime.Const(RAngle),
538
+ ], value => Types.Lowercase(value[2]));
539
+ // ------------------------------------------------------------------
540
+ // Capitalize
541
+ // ------------------------------------------------------------------
542
+ // prettier-ignore
543
+ const Capitalize = index_1.Runtime.Tuple([
544
+ index_1.Runtime.Const('Capitalize'),
545
+ index_1.Runtime.Const(LAngle),
546
+ index_1.Runtime.Ref('Type'),
547
+ index_1.Runtime.Const(RAngle),
548
+ ], value => Types.Capitalize(value[2]));
549
+ // ------------------------------------------------------------------
550
+ // Uncapitalize
551
+ // ------------------------------------------------------------------
552
+ // prettier-ignore
553
+ const Uncapitalize = index_1.Runtime.Tuple([
554
+ index_1.Runtime.Const('Uncapitalize'),
555
+ index_1.Runtime.Const(LAngle),
556
+ index_1.Runtime.Ref('Type'),
557
+ index_1.Runtime.Const(RAngle),
558
+ ], value => Types.Uncapitalize(value[2]));
559
+ // ------------------------------------------------------------------
560
+ // Date
561
+ // ------------------------------------------------------------------
562
+ const Date = index_1.Runtime.Const('Date', index_1.Runtime.As(Types.Date()));
563
+ // ------------------------------------------------------------------
564
+ // Uint8Array
565
+ // ------------------------------------------------------------------
566
+ const Uint8Array = index_1.Runtime.Const('Uint8Array', index_1.Runtime.As(Types.Uint8Array()));
567
+ // ------------------------------------------------------------------
568
+ // Module
569
+ // ------------------------------------------------------------------
570
+ // prettier-ignore
571
+ exports.Module = new index_1.Runtime.Module({
572
+ Literal,
573
+ Keyword,
574
+ KeyOf,
575
+ IndexArray,
576
+ Extends,
577
+ Base,
578
+ Factor,
579
+ ExprTermTail,
580
+ ExprTerm,
581
+ ExprTail,
582
+ Expr,
583
+ Type,
584
+ PropertyKey,
585
+ PropertyReadonly,
586
+ PropertyOptional,
587
+ Property,
588
+ PropertyDelimiter,
589
+ Properties,
590
+ Object,
591
+ Elements,
592
+ Tuple,
593
+ Parameter,
594
+ Function,
595
+ Parameters,
596
+ Constructor,
597
+ Mapped,
598
+ AsyncIterator,
599
+ Iterator,
600
+ Awaited,
601
+ Array,
602
+ Record,
603
+ Promise,
604
+ ConstructorParameters,
605
+ FunctionParameters,
606
+ InstanceType,
607
+ ReturnType,
608
+ Partial,
609
+ Required,
610
+ Pick,
611
+ Omit,
612
+ Exclude,
613
+ Extract,
614
+ Uppercase,
615
+ Lowercase,
616
+ Capitalize,
617
+ Uncapitalize,
618
+ Date,
619
+ Uint8Array,
620
+ Reference
621
+ });