@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.
- package/build/cjs/syntax/index.d.ts +1 -1
- package/build/cjs/syntax/index.js +1 -1
- package/build/cjs/syntax/runtime.d.ts +38 -54
- package/build/cjs/syntax/runtime.js +60 -202
- package/build/cjs/syntax/static.d.ts +62 -148
- package/build/cjs/syntax/syntax.d.ts +33 -0
- package/build/cjs/syntax/syntax.js +37 -0
- package/build/cjs/type/constructor-parameters/constructor-parameters.d.ts +3 -3
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +3 -1
- package/build/cjs/type/instance-type/instance-type.d.ts +5 -4
- package/build/cjs/type/instance-type/instance-type.js +3 -1
- package/build/cjs/type/parameters/parameters.d.ts +3 -3
- package/build/cjs/type/parameters/parameters.js +3 -1
- package/build/cjs/type/return-type/return-type.d.ts +5 -4
- package/build/cjs/type/return-type/return-type.js +3 -1
- package/build/cjs/type/type/javascript.d.ts +4 -4
- package/build/esm/syntax/index.d.mts +1 -1
- package/build/esm/syntax/index.mjs +1 -1
- package/build/esm/syntax/runtime.d.mts +38 -54
- package/build/esm/syntax/runtime.mjs +60 -202
- package/build/esm/syntax/static.d.mts +62 -148
- package/build/esm/syntax/syntax.d.mts +33 -0
- package/build/esm/syntax/syntax.mjs +30 -0
- package/build/esm/type/constructor-parameters/constructor-parameters.d.mts +3 -3
- package/build/esm/type/constructor-parameters/constructor-parameters.mjs +3 -1
- package/build/esm/type/instance-type/instance-type.d.mts +5 -4
- package/build/esm/type/instance-type/instance-type.mjs +3 -1
- package/build/esm/type/parameters/parameters.d.mts +3 -3
- package/build/esm/type/parameters/parameters.mjs +3 -1
- package/build/esm/type/return-type/return-type.d.mts +5 -4
- package/build/esm/type/return-type/return-type.mjs +3 -1
- package/build/esm/type/type/javascript.d.mts +4 -4
- package/package.json +11 -1
- package/parser/package.json +4 -0
- package/readme.md +86 -160
- package/build/cjs/syntax/parse.d.ts +0 -15
- package/build/cjs/syntax/parse.js +0 -19
- package/build/esm/syntax/parse.d.mts +0 -15
- package/build/esm/syntax/parse.mjs +0 -14
- /package/build/cjs/{syntax/parsebox → parser}/index.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/index.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/guard.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/index.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/index.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/module.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/module.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/parse.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/token.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/token.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/types.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/runtime/types.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/index.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/index.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/parse.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/parse.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/token.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/token.js +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/types.d.ts +0 -0
- /package/build/cjs/{syntax/parsebox → parser}/static/types.js +0 -0
- /package/build/esm/{syntax/parsebox → parser}/index.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/index.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/guard.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/guard.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/index.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/index.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/module.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/module.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/parse.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/parse.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/token.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/token.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/types.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/runtime/types.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/index.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/index.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/parse.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/parse.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/token.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/token.mjs +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/types.d.mts +0 -0
- /package/build/esm/{syntax/parsebox → parser}/static/types.mjs +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Runtime } from '
|
|
2
|
-
import * as
|
|
1
|
+
import { Runtime } from '../parser/index.mjs';
|
|
2
|
+
import * as t from '../type/index.mjs';
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Tokens
|
|
5
5
|
// ------------------------------------------------------------------
|
|
@@ -33,126 +33,9 @@ function DestructureRight(values) {
|
|
|
33
33
|
// Deref
|
|
34
34
|
// ------------------------------------------------------------------
|
|
35
35
|
const Deref = (context, key) => {
|
|
36
|
-
return key in context ? context[key] :
|
|
36
|
+
return key in context ? context[key] : t.Ref(key);
|
|
37
37
|
};
|
|
38
38
|
// ------------------------------------------------------------------
|
|
39
|
-
// ExportModifier
|
|
40
|
-
// ------------------------------------------------------------------
|
|
41
|
-
// prettier-ignore
|
|
42
|
-
const ExportModifierMapping = (values) => {
|
|
43
|
-
return values.length === 1;
|
|
44
|
-
};
|
|
45
|
-
// prettier-ignore
|
|
46
|
-
const ExportModifier = Runtime.Union([
|
|
47
|
-
Runtime.Tuple([Runtime.Const('export')]), Runtime.Tuple([])
|
|
48
|
-
], ExportModifierMapping);
|
|
49
|
-
// ------------------------------------------------------------------
|
|
50
|
-
// TypeAliasDeclaration
|
|
51
|
-
// ------------------------------------------------------------------
|
|
52
|
-
// prettier-ignore
|
|
53
|
-
const TypeAliasDeclarationMapping = (_Export, _Keyword, Ident, _Equals, Type) => {
|
|
54
|
-
return { [Ident]: Type };
|
|
55
|
-
};
|
|
56
|
-
// prettier-ignore
|
|
57
|
-
const TypeAliasDeclaration = Runtime.Tuple([
|
|
58
|
-
Runtime.Ref('ExportModifier'),
|
|
59
|
-
Runtime.Const('type'),
|
|
60
|
-
Runtime.Ident(),
|
|
61
|
-
Runtime.Const(Equals),
|
|
62
|
-
Runtime.Ref('Type')
|
|
63
|
-
], value => TypeAliasDeclarationMapping(...value));
|
|
64
|
-
// ------------------------------------------------------------------
|
|
65
|
-
// HeritageList
|
|
66
|
-
// ------------------------------------------------------------------
|
|
67
|
-
// prettier-ignore (note, heritage list should disallow trailing comma)
|
|
68
|
-
const HeritageListDelimiter = Runtime.Union([Runtime.Tuple([Runtime.Const(Comma), Runtime.Const(Newline)]), Runtime.Tuple([Runtime.Const(Comma)])]);
|
|
69
|
-
// prettier-ignore
|
|
70
|
-
const HeritageListMapping = (values, context) => {
|
|
71
|
-
return (values.length === 3 ? [Deref(context, values[0]), ...values[2]] :
|
|
72
|
-
values.length === 1 ? [Deref(context, values[0])] :
|
|
73
|
-
[]);
|
|
74
|
-
};
|
|
75
|
-
// prettier-ignore
|
|
76
|
-
const HeritageList = Runtime.Union([
|
|
77
|
-
Runtime.Tuple([Runtime.Ident(), HeritageListDelimiter, Runtime.Ref('HeritageList')]),
|
|
78
|
-
Runtime.Tuple([Runtime.Ident()]),
|
|
79
|
-
Runtime.Tuple([])
|
|
80
|
-
], HeritageListMapping);
|
|
81
|
-
// ------------------------------------------------------------------
|
|
82
|
-
// Heritage
|
|
83
|
-
// ------------------------------------------------------------------
|
|
84
|
-
// prettier-ignore
|
|
85
|
-
const HeritageMapping = (values) => {
|
|
86
|
-
return (values.length === 2 ? values[1] : []);
|
|
87
|
-
};
|
|
88
|
-
// prettier-ignore
|
|
89
|
-
const Heritage = Runtime.Union([
|
|
90
|
-
Runtime.Tuple([Runtime.Const('extends'), Runtime.Ref('HeritageList')]),
|
|
91
|
-
Runtime.Tuple([])
|
|
92
|
-
], HeritageMapping);
|
|
93
|
-
// ------------------------------------------------------------------
|
|
94
|
-
// InterfaceDeclaration
|
|
95
|
-
// ------------------------------------------------------------------
|
|
96
|
-
// prettier-ignore
|
|
97
|
-
const InterfaceDeclarationMapping = (_0, _1, Ident, Heritage, _4, Properties, _6) => {
|
|
98
|
-
return { [Ident]: Types.Intersect([...Heritage, Types.Object(Properties)]) };
|
|
99
|
-
};
|
|
100
|
-
// prettier-ignore
|
|
101
|
-
const InterfaceDeclaration = Runtime.Tuple([
|
|
102
|
-
Runtime.Ref('ExportModifier'),
|
|
103
|
-
Runtime.Const('interface'),
|
|
104
|
-
Runtime.Ident(),
|
|
105
|
-
Runtime.Ref('Heritage'),
|
|
106
|
-
Runtime.Const(LBrace),
|
|
107
|
-
Runtime.Ref('Properties'),
|
|
108
|
-
Runtime.Const(RBrace),
|
|
109
|
-
], values => InterfaceDeclarationMapping(...values));
|
|
110
|
-
// ------------------------------------------------------------------
|
|
111
|
-
// ModuleType
|
|
112
|
-
// ------------------------------------------------------------------
|
|
113
|
-
// prettier-ignore
|
|
114
|
-
const ModuleType = Runtime.Union([
|
|
115
|
-
Runtime.Ref('InterfaceDeclaration'),
|
|
116
|
-
Runtime.Ref('TypeAliasDeclaration')
|
|
117
|
-
]);
|
|
118
|
-
// ------------------------------------------------------------------
|
|
119
|
-
// ModuleProperties
|
|
120
|
-
// ------------------------------------------------------------------
|
|
121
|
-
// prettier-ignore
|
|
122
|
-
const ModulePropertiesDelimiter = Runtime.Union([
|
|
123
|
-
Runtime.Tuple([Runtime.Const(SemiColon), Runtime.Const(Newline)]),
|
|
124
|
-
Runtime.Tuple([Runtime.Const(SemiColon)]),
|
|
125
|
-
Runtime.Tuple([Runtime.Const(Newline)]),
|
|
126
|
-
]);
|
|
127
|
-
// prettier-ignore
|
|
128
|
-
const ModulePropertiesMapping = (values) => {
|
|
129
|
-
return (values.length === 3 ? { ...values[0], ...values[2] } :
|
|
130
|
-
values.length === 1 ? values[0] :
|
|
131
|
-
{});
|
|
132
|
-
};
|
|
133
|
-
// prettier-ignore
|
|
134
|
-
const ModuleProperties = Runtime.Union([
|
|
135
|
-
Runtime.Tuple([Runtime.Ref('ModuleType'), ModulePropertiesDelimiter, Runtime.Ref('ModuleProperties')]),
|
|
136
|
-
Runtime.Tuple([Runtime.Ref('ModuleType')]),
|
|
137
|
-
Runtime.Tuple([]),
|
|
138
|
-
], ModulePropertiesMapping);
|
|
139
|
-
// ------------------------------------------------------------------
|
|
140
|
-
// ModuleDeclaration
|
|
141
|
-
// ------------------------------------------------------------------
|
|
142
|
-
// prettier-ignore
|
|
143
|
-
const ModuleIdentifier = Runtime.Union([
|
|
144
|
-
Runtime.Tuple([Runtime.Ident()]),
|
|
145
|
-
Runtime.Tuple([])
|
|
146
|
-
]);
|
|
147
|
-
// prettier-ignore
|
|
148
|
-
const ModuleDeclarationMapping = (_1, _2, _Ident, _3, Properties, _5) => {
|
|
149
|
-
return Types.Module(Properties);
|
|
150
|
-
};
|
|
151
|
-
// prettier-ignore
|
|
152
|
-
const ModuleDeclaration = Runtime.Tuple([
|
|
153
|
-
Runtime.Ref('ExportModifier'), Runtime.Const('module'), ModuleIdentifier, Runtime.Const(LBrace), Runtime.Ref('ModuleProperties'), Runtime.Const(RBrace)
|
|
154
|
-
], values => ModuleDeclarationMapping(...values));
|
|
155
|
-
// ------------------------------------------------------------------
|
|
156
39
|
// Reference
|
|
157
40
|
// ------------------------------------------------------------------
|
|
158
41
|
// prettier-ignore
|
|
@@ -162,27 +45,27 @@ const Reference = Runtime.Ident((value, context) => Deref(context, value));
|
|
|
162
45
|
// ------------------------------------------------------------------
|
|
163
46
|
// prettier-ignore
|
|
164
47
|
const Literal = Runtime.Union([
|
|
165
|
-
Runtime.Union([Runtime.Const('true'), Runtime.Const('false')], value =>
|
|
166
|
-
Runtime.Number(value =>
|
|
167
|
-
Runtime.String([SingleQuote, DoubleQuote, Tilde], value =>
|
|
48
|
+
Runtime.Union([Runtime.Const('true'), Runtime.Const('false')], value => t.Literal(value === 'true')),
|
|
49
|
+
Runtime.Number(value => t.Literal(parseFloat(value))),
|
|
50
|
+
Runtime.String([SingleQuote, DoubleQuote, Tilde], value => t.Literal(value))
|
|
168
51
|
]);
|
|
169
52
|
// ------------------------------------------------------------------
|
|
170
53
|
// Keyword
|
|
171
54
|
// ------------------------------------------------------------------
|
|
172
55
|
// prettier-ignore
|
|
173
56
|
const Keyword = Runtime.Union([
|
|
174
|
-
Runtime.Const('any', Runtime.As(
|
|
175
|
-
Runtime.Const('bigint', Runtime.As(
|
|
176
|
-
Runtime.Const('boolean', Runtime.As(
|
|
177
|
-
Runtime.Const('integer', Runtime.As(
|
|
178
|
-
Runtime.Const('never', Runtime.As(
|
|
179
|
-
Runtime.Const('null', Runtime.As(
|
|
180
|
-
Runtime.Const('number', Runtime.As(
|
|
181
|
-
Runtime.Const('string', Runtime.As(
|
|
182
|
-
Runtime.Const('symbol', Runtime.As(
|
|
183
|
-
Runtime.Const('undefined', Runtime.As(
|
|
184
|
-
Runtime.Const('unknown', Runtime.As(
|
|
185
|
-
Runtime.Const('void', Runtime.As(
|
|
57
|
+
Runtime.Const('any', Runtime.As(t.Any())),
|
|
58
|
+
Runtime.Const('bigint', Runtime.As(t.BigInt())),
|
|
59
|
+
Runtime.Const('boolean', Runtime.As(t.Boolean())),
|
|
60
|
+
Runtime.Const('integer', Runtime.As(t.Integer())),
|
|
61
|
+
Runtime.Const('never', Runtime.As(t.Never())),
|
|
62
|
+
Runtime.Const('null', Runtime.As(t.Null())),
|
|
63
|
+
Runtime.Const('number', Runtime.As(t.Number())),
|
|
64
|
+
Runtime.Const('string', Runtime.As(t.String())),
|
|
65
|
+
Runtime.Const('symbol', Runtime.As(t.Symbol())),
|
|
66
|
+
Runtime.Const('undefined', Runtime.As(t.Undefined())),
|
|
67
|
+
Runtime.Const('unknown', Runtime.As(t.Unknown())),
|
|
68
|
+
Runtime.Const('void', Runtime.As(t.Void())),
|
|
186
69
|
]);
|
|
187
70
|
// ------------------------------------------------------------------
|
|
188
71
|
// KeyOf
|
|
@@ -273,22 +156,22 @@ const Base = Runtime.Union([
|
|
|
273
156
|
// prettier-ignore
|
|
274
157
|
const FactorExtends = (Type, Extends) => {
|
|
275
158
|
return Extends.length === 3
|
|
276
|
-
?
|
|
159
|
+
? t.Extends(Type, Extends[0], Extends[1], Extends[2])
|
|
277
160
|
: Type;
|
|
278
161
|
};
|
|
279
162
|
// prettier-ignore
|
|
280
163
|
const FactorIndexArray = (Type, IndexArray) => {
|
|
281
164
|
const [Left, Right] = DestructureRight(IndexArray);
|
|
282
|
-
return (!
|
|
165
|
+
return (!t.ValueGuard.IsUndefined(Right) ? (
|
|
283
166
|
// note: Indexed types require reimplementation to replace `[number]` indexers
|
|
284
|
-
Right.length === 1 ?
|
|
285
|
-
Right.length === 0 ?
|
|
286
|
-
|
|
167
|
+
Right.length === 1 ? t.Index(FactorIndexArray(Type, Left), Right[0]) :
|
|
168
|
+
Right.length === 0 ? t.Array(FactorIndexArray(Type, Left)) :
|
|
169
|
+
t.Never()) : Type);
|
|
287
170
|
};
|
|
288
171
|
// prettier-ignore
|
|
289
172
|
const FactorMapping = (KeyOf, Type, IndexArray, Extends) => {
|
|
290
173
|
return KeyOf
|
|
291
|
-
? FactorExtends(
|
|
174
|
+
? FactorExtends(t.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
|
|
292
175
|
: FactorExtends(FactorIndexArray(Type, IndexArray), Extends);
|
|
293
176
|
};
|
|
294
177
|
// prettier-ignore
|
|
@@ -307,14 +190,14 @@ function ExprBinaryMapping(Left, Rest) {
|
|
|
307
190
|
const [Operator, Right, Next] = Rest;
|
|
308
191
|
const Schema = ExprBinaryMapping(Right, Next);
|
|
309
192
|
if (Operator === '&') {
|
|
310
|
-
return
|
|
311
|
-
?
|
|
312
|
-
:
|
|
193
|
+
return t.TypeGuard.IsIntersect(Schema)
|
|
194
|
+
? t.Intersect([Left, ...Schema.allOf])
|
|
195
|
+
: t.Intersect([Left, Schema]);
|
|
313
196
|
}
|
|
314
197
|
if (Operator === '|') {
|
|
315
|
-
return
|
|
316
|
-
?
|
|
317
|
-
:
|
|
198
|
+
return t.TypeGuard.IsUnion(Schema)
|
|
199
|
+
? t.Union([Left, ...Schema.anyOf])
|
|
200
|
+
: t.Union([Left, Schema]);
|
|
318
201
|
}
|
|
319
202
|
throw 1;
|
|
320
203
|
})() : Left);
|
|
@@ -349,9 +232,9 @@ const Readonly = Runtime.Union([Runtime.Tuple([Runtime.Const('readonly')]), Runt
|
|
|
349
232
|
const Optional = Runtime.Union([Runtime.Tuple([Runtime.Const(Question)]), Runtime.Tuple([])], (value) => value.length > 0);
|
|
350
233
|
// prettier-ignore
|
|
351
234
|
const PropertyMapping = (IsReadonly, Key, IsOptional, _, Type) => ({
|
|
352
|
-
[Key]: (IsReadonly && IsOptional ?
|
|
353
|
-
IsReadonly && !IsOptional ?
|
|
354
|
-
!IsReadonly && IsOptional ?
|
|
235
|
+
[Key]: (IsReadonly && IsOptional ? t.ReadonlyOptional(Type) :
|
|
236
|
+
IsReadonly && !IsOptional ? t.Readonly(Type) :
|
|
237
|
+
!IsReadonly && IsOptional ? t.Optional(Type) :
|
|
355
238
|
Type)
|
|
356
239
|
});
|
|
357
240
|
// prettier-ignore
|
|
@@ -384,7 +267,7 @@ const Properties = Runtime.Union([
|
|
|
384
267
|
// Object
|
|
385
268
|
// ------------------------------------------------------------------
|
|
386
269
|
// prettier-ignore
|
|
387
|
-
const ObjectMapping = (_0, Properties, _2) =>
|
|
270
|
+
const ObjectMapping = (_0, Properties, _2) => t.Object(Properties);
|
|
388
271
|
// prettier-ignore
|
|
389
272
|
const _Object = Runtime.Tuple([
|
|
390
273
|
Runtime.Const(LBrace),
|
|
@@ -409,7 +292,7 @@ const Tuple = Runtime.Tuple([
|
|
|
409
292
|
Runtime.Const(LBracket),
|
|
410
293
|
Runtime.Ref('Elements'),
|
|
411
294
|
Runtime.Const(RBracket)
|
|
412
|
-
], value =>
|
|
295
|
+
], value => t.Tuple(value[1]));
|
|
413
296
|
// ------------------------------------------------------------------
|
|
414
297
|
// Parameters
|
|
415
298
|
// ------------------------------------------------------------------
|
|
@@ -438,7 +321,7 @@ const Constructor = Runtime.Tuple([
|
|
|
438
321
|
Runtime.Const(RParen),
|
|
439
322
|
Runtime.Const('=>'),
|
|
440
323
|
Runtime.Ref('Type')
|
|
441
|
-
], value =>
|
|
324
|
+
], value => t.Constructor(value[2], value[5]));
|
|
442
325
|
// ------------------------------------------------------------------
|
|
443
326
|
// Function
|
|
444
327
|
// ------------------------------------------------------------------
|
|
@@ -449,13 +332,13 @@ const Function = Runtime.Tuple([
|
|
|
449
332
|
Runtime.Const(RParen),
|
|
450
333
|
Runtime.Const('=>'),
|
|
451
334
|
Runtime.Ref('Type')
|
|
452
|
-
], value =>
|
|
335
|
+
], value => t.Function(value[1], value[4]));
|
|
453
336
|
// ------------------------------------------------------------------
|
|
454
337
|
// Mapped (requires deferred types)
|
|
455
338
|
// ------------------------------------------------------------------
|
|
456
339
|
// prettier-ignore
|
|
457
340
|
const MappedMapping = (values) => {
|
|
458
|
-
return
|
|
341
|
+
return t.Literal('Mapped types not supported');
|
|
459
342
|
};
|
|
460
343
|
// prettier-ignore
|
|
461
344
|
const Mapped = Runtime.Tuple([
|
|
@@ -478,7 +361,7 @@ const AsyncIterator = Runtime.Tuple([
|
|
|
478
361
|
Runtime.Const(LAngle),
|
|
479
362
|
Runtime.Ref('Type'),
|
|
480
363
|
Runtime.Const(RAngle),
|
|
481
|
-
], value =>
|
|
364
|
+
], value => t.AsyncIterator(value[2]));
|
|
482
365
|
// ------------------------------------------------------------------
|
|
483
366
|
// Iterator
|
|
484
367
|
// ------------------------------------------------------------------
|
|
@@ -488,7 +371,7 @@ const Iterator = Runtime.Tuple([
|
|
|
488
371
|
Runtime.Const(LAngle),
|
|
489
372
|
Runtime.Ref('Type'),
|
|
490
373
|
Runtime.Const(RAngle),
|
|
491
|
-
], value =>
|
|
374
|
+
], value => t.Iterator(value[2]));
|
|
492
375
|
// ------------------------------------------------------------------
|
|
493
376
|
// ConstructorParameters
|
|
494
377
|
// ------------------------------------------------------------------
|
|
@@ -498,7 +381,7 @@ const ConstructorParameters = Runtime.Tuple([
|
|
|
498
381
|
Runtime.Const(LAngle),
|
|
499
382
|
Runtime.Ref('Type'),
|
|
500
383
|
Runtime.Const(RAngle),
|
|
501
|
-
], value =>
|
|
384
|
+
], value => t.ConstructorParameters(value[2]));
|
|
502
385
|
// ------------------------------------------------------------------
|
|
503
386
|
// Parameters
|
|
504
387
|
// ------------------------------------------------------------------
|
|
@@ -508,7 +391,7 @@ const FunctionParameters = Runtime.Tuple([
|
|
|
508
391
|
Runtime.Const(LAngle),
|
|
509
392
|
Runtime.Ref('Type'),
|
|
510
393
|
Runtime.Const(RAngle),
|
|
511
|
-
], value =>
|
|
394
|
+
], value => t.Parameters(value[2]));
|
|
512
395
|
// ------------------------------------------------------------------
|
|
513
396
|
// InstanceType
|
|
514
397
|
// ------------------------------------------------------------------
|
|
@@ -518,7 +401,7 @@ const InstanceType = Runtime.Tuple([
|
|
|
518
401
|
Runtime.Const(LAngle),
|
|
519
402
|
Runtime.Ref('Type'),
|
|
520
403
|
Runtime.Const(RAngle),
|
|
521
|
-
], value =>
|
|
404
|
+
], value => t.InstanceType(value[2]));
|
|
522
405
|
// ------------------------------------------------------------------
|
|
523
406
|
// ReturnType
|
|
524
407
|
// ------------------------------------------------------------------
|
|
@@ -528,7 +411,7 @@ const ReturnType = Runtime.Tuple([
|
|
|
528
411
|
Runtime.Const(LAngle),
|
|
529
412
|
Runtime.Ref('Type'),
|
|
530
413
|
Runtime.Const(RAngle),
|
|
531
|
-
], value =>
|
|
414
|
+
], value => t.ReturnType(value[2]));
|
|
532
415
|
// ------------------------------------------------------------------
|
|
533
416
|
// Awaited
|
|
534
417
|
// ------------------------------------------------------------------
|
|
@@ -538,7 +421,7 @@ const Awaited = Runtime.Tuple([
|
|
|
538
421
|
Runtime.Const(LAngle),
|
|
539
422
|
Runtime.Ref('Type'),
|
|
540
423
|
Runtime.Const(RAngle),
|
|
541
|
-
], value =>
|
|
424
|
+
], value => t.Awaited(value[2]));
|
|
542
425
|
// ------------------------------------------------------------------
|
|
543
426
|
// Array
|
|
544
427
|
// ------------------------------------------------------------------
|
|
@@ -548,7 +431,7 @@ const Array = Runtime.Tuple([
|
|
|
548
431
|
Runtime.Const(LAngle),
|
|
549
432
|
Runtime.Ref('Type'),
|
|
550
433
|
Runtime.Const(RAngle),
|
|
551
|
-
], value =>
|
|
434
|
+
], value => t.Array(value[2]));
|
|
552
435
|
// ------------------------------------------------------------------
|
|
553
436
|
// Record
|
|
554
437
|
// ------------------------------------------------------------------
|
|
@@ -560,7 +443,7 @@ const Record = Runtime.Tuple([
|
|
|
560
443
|
Runtime.Const(Comma),
|
|
561
444
|
Runtime.Ref('Type'),
|
|
562
445
|
Runtime.Const(RAngle),
|
|
563
|
-
], value =>
|
|
446
|
+
], value => t.Record(value[2], value[4]));
|
|
564
447
|
// ------------------------------------------------------------------
|
|
565
448
|
// Promise
|
|
566
449
|
// ------------------------------------------------------------------
|
|
@@ -570,7 +453,7 @@ const Promise = Runtime.Tuple([
|
|
|
570
453
|
Runtime.Const(LAngle),
|
|
571
454
|
Runtime.Ref('Type'),
|
|
572
455
|
Runtime.Const(RAngle),
|
|
573
|
-
], value =>
|
|
456
|
+
], value => t.Promise(value[2]));
|
|
574
457
|
// ------------------------------------------------------------------
|
|
575
458
|
// Partial
|
|
576
459
|
// ------------------------------------------------------------------
|
|
@@ -580,7 +463,7 @@ const Partial = Runtime.Tuple([
|
|
|
580
463
|
Runtime.Const(LAngle),
|
|
581
464
|
Runtime.Ref('Type'),
|
|
582
465
|
Runtime.Const(RAngle),
|
|
583
|
-
], value =>
|
|
466
|
+
], value => t.Partial(value[2]));
|
|
584
467
|
// ------------------------------------------------------------------
|
|
585
468
|
// Required
|
|
586
469
|
// ------------------------------------------------------------------
|
|
@@ -590,7 +473,7 @@ const Required = Runtime.Tuple([
|
|
|
590
473
|
Runtime.Const(LAngle),
|
|
591
474
|
Runtime.Ref('Type'),
|
|
592
475
|
Runtime.Const(RAngle),
|
|
593
|
-
], value =>
|
|
476
|
+
], value => t.Required(value[2]));
|
|
594
477
|
// ------------------------------------------------------------------
|
|
595
478
|
// Pick
|
|
596
479
|
// ------------------------------------------------------------------
|
|
@@ -602,7 +485,7 @@ const Pick = Runtime.Tuple([
|
|
|
602
485
|
Runtime.Const(Comma),
|
|
603
486
|
Runtime.Ref('Type'),
|
|
604
487
|
Runtime.Const(RAngle),
|
|
605
|
-
], value =>
|
|
488
|
+
], value => t.Pick(value[2], value[4]));
|
|
606
489
|
// ------------------------------------------------------------------
|
|
607
490
|
// Omit
|
|
608
491
|
// ------------------------------------------------------------------
|
|
@@ -614,7 +497,7 @@ const Omit = Runtime.Tuple([
|
|
|
614
497
|
Runtime.Const(Comma),
|
|
615
498
|
Runtime.Ref('Type'),
|
|
616
499
|
Runtime.Const(RAngle),
|
|
617
|
-
], value =>
|
|
500
|
+
], value => t.Omit(value[2], value[4]));
|
|
618
501
|
// ------------------------------------------------------------------
|
|
619
502
|
// Exclude
|
|
620
503
|
// ------------------------------------------------------------------
|
|
@@ -626,7 +509,7 @@ const Exclude = Runtime.Tuple([
|
|
|
626
509
|
Runtime.Const(Comma),
|
|
627
510
|
Runtime.Ref('Type'),
|
|
628
511
|
Runtime.Const(RAngle),
|
|
629
|
-
], value =>
|
|
512
|
+
], value => t.Exclude(value[2], value[4]));
|
|
630
513
|
// ------------------------------------------------------------------
|
|
631
514
|
// Extract
|
|
632
515
|
// ------------------------------------------------------------------
|
|
@@ -638,7 +521,7 @@ const Extract = Runtime.Tuple([
|
|
|
638
521
|
Runtime.Const(Comma),
|
|
639
522
|
Runtime.Ref('Type'),
|
|
640
523
|
Runtime.Const(RAngle),
|
|
641
|
-
], value =>
|
|
524
|
+
], value => t.Extract(value[2], value[4]));
|
|
642
525
|
// ------------------------------------------------------------------
|
|
643
526
|
// Uppercase
|
|
644
527
|
// ------------------------------------------------------------------
|
|
@@ -648,7 +531,7 @@ const Uppercase = Runtime.Tuple([
|
|
|
648
531
|
Runtime.Const(LAngle),
|
|
649
532
|
Runtime.Ref('Type'),
|
|
650
533
|
Runtime.Const(RAngle),
|
|
651
|
-
], value =>
|
|
534
|
+
], value => t.Uppercase(value[2]));
|
|
652
535
|
// ------------------------------------------------------------------
|
|
653
536
|
// Lowercase
|
|
654
537
|
// ------------------------------------------------------------------
|
|
@@ -658,7 +541,7 @@ const Lowercase = Runtime.Tuple([
|
|
|
658
541
|
Runtime.Const(LAngle),
|
|
659
542
|
Runtime.Ref('Type'),
|
|
660
543
|
Runtime.Const(RAngle),
|
|
661
|
-
], value =>
|
|
544
|
+
], value => t.Lowercase(value[2]));
|
|
662
545
|
// ------------------------------------------------------------------
|
|
663
546
|
// Capitalize
|
|
664
547
|
// ------------------------------------------------------------------
|
|
@@ -668,7 +551,7 @@ const Capitalize = Runtime.Tuple([
|
|
|
668
551
|
Runtime.Const(LAngle),
|
|
669
552
|
Runtime.Ref('Type'),
|
|
670
553
|
Runtime.Const(RAngle),
|
|
671
|
-
], value =>
|
|
554
|
+
], value => t.Capitalize(value[2]));
|
|
672
555
|
// ------------------------------------------------------------------
|
|
673
556
|
// Uncapitalize
|
|
674
557
|
// ------------------------------------------------------------------
|
|
@@ -678,41 +561,20 @@ const Uncapitalize = Runtime.Tuple([
|
|
|
678
561
|
Runtime.Const(LAngle),
|
|
679
562
|
Runtime.Ref('Type'),
|
|
680
563
|
Runtime.Const(RAngle),
|
|
681
|
-
], value =>
|
|
564
|
+
], value => t.Uncapitalize(value[2]));
|
|
682
565
|
// ------------------------------------------------------------------
|
|
683
566
|
// Date
|
|
684
567
|
// ------------------------------------------------------------------
|
|
685
|
-
const Date = Runtime.Const('Date', Runtime.As(
|
|
568
|
+
const Date = Runtime.Const('Date', Runtime.As(t.Date()));
|
|
686
569
|
// ------------------------------------------------------------------
|
|
687
570
|
// Uint8Array
|
|
688
571
|
// ------------------------------------------------------------------
|
|
689
|
-
const Uint8Array = Runtime.Const('Uint8Array', Runtime.As(
|
|
690
|
-
// ------------------------------------------------------------------
|
|
691
|
-
// Main
|
|
692
|
-
// ------------------------------------------------------------------
|
|
693
|
-
// prettier-ignore
|
|
694
|
-
const Main = Runtime.Union([
|
|
695
|
-
ModuleDeclaration,
|
|
696
|
-
TypeAliasDeclaration,
|
|
697
|
-
InterfaceDeclaration,
|
|
698
|
-
Type
|
|
699
|
-
]);
|
|
572
|
+
const Uint8Array = Runtime.Const('Uint8Array', Runtime.As(t.Uint8Array()));
|
|
700
573
|
// ------------------------------------------------------------------
|
|
701
574
|
// Module
|
|
702
575
|
// ------------------------------------------------------------------
|
|
703
576
|
// prettier-ignore
|
|
704
577
|
export const Module = new Runtime.Module({
|
|
705
|
-
// ----------------------------------------------------------------
|
|
706
|
-
// Modules, Interfaces and Type Aliases
|
|
707
|
-
// ----------------------------------------------------------------
|
|
708
|
-
ExportModifier,
|
|
709
|
-
HeritageList,
|
|
710
|
-
Heritage,
|
|
711
|
-
InterfaceDeclaration,
|
|
712
|
-
TypeAliasDeclaration,
|
|
713
|
-
ModuleType,
|
|
714
|
-
ModuleProperties,
|
|
715
|
-
ModuleDeclaration,
|
|
716
578
|
// ----------------------------------------------------------------
|
|
717
579
|
// Type Expressions
|
|
718
580
|
// ----------------------------------------------------------------
|
|
@@ -765,8 +627,4 @@ export const Module = new Runtime.Module({
|
|
|
765
627
|
Date,
|
|
766
628
|
Uint8Array,
|
|
767
629
|
Reference,
|
|
768
|
-
// ----------------------------------------------------------------
|
|
769
|
-
// Main
|
|
770
|
-
// ----------------------------------------------------------------
|
|
771
|
-
Main
|
|
772
630
|
});
|