@sinclair/typebox 0.34.28 → 0.34.30
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/runtime.d.ts +6 -5
- package/build/cjs/syntax/runtime.js +145 -148
- package/build/cjs/syntax/static.d.ts +79 -108
- package/build/esm/syntax/runtime.d.mts +6 -5
- package/build/esm/syntax/runtime.mjs +145 -148
- package/build/esm/syntax/static.d.mts +79 -108
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Runtime } from '../parser/index';
|
|
2
2
|
import * as t from '../type/index';
|
|
3
3
|
export declare const Module: Runtime.Module<{
|
|
4
|
-
|
|
4
|
+
GenericArgumentsList: Runtime.ITuple<unknown[]>;
|
|
5
5
|
GenericArguments: Runtime.ITuple<t.TProperties>;
|
|
6
6
|
Literal: Runtime.IUnion<t.TLiteral<string> | t.TLiteral<number> | t.TLiteral<boolean>>;
|
|
7
7
|
Keyword: Runtime.IUnion<t.TAny | t.TBoolean | t.TBigInt | t.TNever | t.TString | t.TNumber | t.TInteger | t.TNull | t.TSymbol | t.TUndefined | t.TUnknown | t.TVoid>;
|
|
8
8
|
KeyOf: Runtime.IUnion<boolean>;
|
|
9
|
-
IndexArray: Runtime.
|
|
9
|
+
IndexArray: Runtime.IArray<unknown[]>;
|
|
10
10
|
Extends: Runtime.IUnion<unknown[]>;
|
|
11
11
|
Base: Runtime.IUnion<unknown>;
|
|
12
12
|
Factor: Runtime.ITuple<t.TSchema>;
|
|
@@ -22,13 +22,13 @@ export declare const Module: Runtime.Module<{
|
|
|
22
22
|
[x: string]: t.TSchema;
|
|
23
23
|
}>;
|
|
24
24
|
PropertyDelimiter: Runtime.IUnion<[","] | [",", "\n"] | [";"] | [";", "\n"] | ["\n"]>;
|
|
25
|
-
|
|
25
|
+
PropertyList: Runtime.ITuple<unknown[]>;
|
|
26
26
|
Object: Runtime.ITuple<t.TObject<t.TProperties>>;
|
|
27
|
-
|
|
27
|
+
ElementList: Runtime.ITuple<unknown[]>;
|
|
28
28
|
Tuple: Runtime.ITuple<t.TTuple<t.TSchema[]>>;
|
|
29
29
|
Parameter: Runtime.ITuple<t.TSchema>;
|
|
30
|
+
ParameterList: Runtime.ITuple<unknown[]>;
|
|
30
31
|
Function: Runtime.ITuple<t.TFunction<t.TSchema[], t.TSchema>>;
|
|
31
|
-
Parameters: Runtime.IUnion<unknown[]>;
|
|
32
32
|
Constructor: Runtime.ITuple<t.TConstructor<t.TSchema[], t.TSchema>>;
|
|
33
33
|
Mapped: Runtime.ITuple<t.TLiteral<"Mapped types not supported">>;
|
|
34
34
|
AsyncIterator: Runtime.ITuple<t.TAsyncIterator<t.TSchema>>;
|
|
@@ -54,6 +54,7 @@ export declare const Module: Runtime.Module<{
|
|
|
54
54
|
Uncapitalize: Runtime.ITuple<t.TSchema>;
|
|
55
55
|
Date: Runtime.IConst<t.TDate>;
|
|
56
56
|
Uint8Array: Runtime.IConst<t.TUint8Array>;
|
|
57
|
+
GenericReferenceParameters: Runtime.ITuple<unknown[]>;
|
|
57
58
|
GenericReference: Runtime.ITuple<t.TSchema>;
|
|
58
59
|
Reference: Runtime.IIdent<t.TSchema>;
|
|
59
60
|
}>;
|
|
@@ -34,28 +34,40 @@ function DestructureRight(values) {
|
|
|
34
34
|
: [values, undefined];
|
|
35
35
|
}
|
|
36
36
|
// ------------------------------------------------------------------
|
|
37
|
+
// Delimit
|
|
38
|
+
// ------------------------------------------------------------------
|
|
39
|
+
// prettier-ignore
|
|
40
|
+
const DelimitHeadMapping = (results) => results.reduce((result, value) => {
|
|
41
|
+
const [element, _delimiter] = value;
|
|
42
|
+
return [...result, element];
|
|
43
|
+
}, []);
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
const DelimitHead = (element, delimiter) => (index_1.Runtime.Array(index_1.Runtime.Tuple([element, delimiter]), DelimitHeadMapping));
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
const DelimitTail = (element) => index_1.Runtime.Union([
|
|
48
|
+
index_1.Runtime.Tuple([element]),
|
|
49
|
+
index_1.Runtime.Tuple([]),
|
|
50
|
+
]);
|
|
51
|
+
// prettier-ignore
|
|
52
|
+
const DelimitMapping = (results) => {
|
|
53
|
+
return [...results[0], ...results[1]];
|
|
54
|
+
};
|
|
55
|
+
// prettier-ignore
|
|
56
|
+
const Delimit = (element, delimiter) => index_1.Runtime.Tuple([
|
|
57
|
+
DelimitHead(element, delimiter),
|
|
58
|
+
DelimitTail(element),
|
|
59
|
+
], DelimitMapping);
|
|
60
|
+
// ------------------------------------------------------------------
|
|
37
61
|
// Dereference
|
|
38
62
|
// ------------------------------------------------------------------
|
|
39
63
|
const Dereference = (context, key) => {
|
|
40
64
|
return key in context ? context[key] : t.Ref(key);
|
|
41
65
|
};
|
|
42
66
|
// ------------------------------------------------------------------
|
|
43
|
-
//
|
|
67
|
+
// GenericArgumentsList
|
|
44
68
|
// ------------------------------------------------------------------
|
|
45
69
|
// prettier-ignore
|
|
46
|
-
const
|
|
47
|
-
return (results.length === 3 ? [results[0], ...results[2]] :
|
|
48
|
-
results.length === 2 ? [results[0]] :
|
|
49
|
-
results.length === 1 ? [results[0]] :
|
|
50
|
-
[]);
|
|
51
|
-
};
|
|
52
|
-
// prettier-ignore
|
|
53
|
-
const GenericArgumentList = index_1.Runtime.Union([
|
|
54
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ident(), index_1.Runtime.Const(Comma), index_1.Runtime.Ref('GenericArgumentList')]),
|
|
55
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ident(), index_1.Runtime.Const(Comma)]),
|
|
56
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ident()]),
|
|
57
|
-
index_1.Runtime.Tuple([]),
|
|
58
|
-
], (results) => GenericArgumentListMapping(results));
|
|
70
|
+
const GenericArgumentsList = Delimit(index_1.Runtime.Ident(), index_1.Runtime.Const(Comma));
|
|
59
71
|
// ------------------------------------------------------------------
|
|
60
72
|
// GenericArguments
|
|
61
73
|
// ------------------------------------------------------------------
|
|
@@ -74,7 +86,7 @@ const GenericArgumentsMapping = (results, context) => {
|
|
|
74
86
|
// prettier-ignore
|
|
75
87
|
const GenericArguments = index_1.Runtime.Tuple([
|
|
76
88
|
index_1.Runtime.Const(LAngle),
|
|
77
|
-
index_1.Runtime.Ref('
|
|
89
|
+
index_1.Runtime.Ref('GenericArgumentsList'),
|
|
78
90
|
index_1.Runtime.Const(RAngle),
|
|
79
91
|
], (results, context) => GenericArgumentsMapping(results, context));
|
|
80
92
|
// ------------------------------------------------------------------
|
|
@@ -85,11 +97,12 @@ function GenericReferenceMapping(results, context) {
|
|
|
85
97
|
const args = results[2];
|
|
86
98
|
return t.Instantiate(type, args);
|
|
87
99
|
}
|
|
100
|
+
const GenericReferenceParameters = Delimit(index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma));
|
|
88
101
|
// prettier-ignore
|
|
89
102
|
const GenericReference = index_1.Runtime.Tuple([
|
|
90
103
|
index_1.Runtime.Ident(),
|
|
91
104
|
index_1.Runtime.Const(LAngle),
|
|
92
|
-
index_1.Runtime.Ref('
|
|
105
|
+
index_1.Runtime.Ref('GenericReferenceParameters'),
|
|
93
106
|
index_1.Runtime.Const(RAngle)
|
|
94
107
|
], (results, context) => GenericReferenceMapping(results, context));
|
|
95
108
|
// ------------------------------------------------------------------
|
|
@@ -115,17 +128,17 @@ const Literal = index_1.Runtime.Union([
|
|
|
115
128
|
// ------------------------------------------------------------------
|
|
116
129
|
// prettier-ignore
|
|
117
130
|
const Keyword = index_1.Runtime.Union([
|
|
118
|
-
index_1.Runtime.Const('
|
|
119
|
-
index_1.Runtime.Const('
|
|
131
|
+
index_1.Runtime.Const('string', index_1.Runtime.As(t.String())),
|
|
132
|
+
index_1.Runtime.Const('number', index_1.Runtime.As(t.Number())),
|
|
120
133
|
index_1.Runtime.Const('boolean', index_1.Runtime.As(t.Boolean())),
|
|
134
|
+
index_1.Runtime.Const('undefined', index_1.Runtime.As(t.Undefined())),
|
|
135
|
+
index_1.Runtime.Const('null', index_1.Runtime.As(t.Null())),
|
|
121
136
|
index_1.Runtime.Const('integer', index_1.Runtime.As(t.Integer())),
|
|
137
|
+
index_1.Runtime.Const('bigint', index_1.Runtime.As(t.BigInt())),
|
|
138
|
+
index_1.Runtime.Const('unknown', index_1.Runtime.As(t.Unknown())),
|
|
139
|
+
index_1.Runtime.Const('any', index_1.Runtime.As(t.Any())),
|
|
122
140
|
index_1.Runtime.Const('never', index_1.Runtime.As(t.Never())),
|
|
123
|
-
index_1.Runtime.Const('null', index_1.Runtime.As(t.Null())),
|
|
124
|
-
index_1.Runtime.Const('number', index_1.Runtime.As(t.Number())),
|
|
125
|
-
index_1.Runtime.Const('string', index_1.Runtime.As(t.String())),
|
|
126
141
|
index_1.Runtime.Const('symbol', index_1.Runtime.As(t.Symbol())),
|
|
127
|
-
index_1.Runtime.Const('undefined', index_1.Runtime.As(t.Undefined())),
|
|
128
|
-
index_1.Runtime.Const('unknown', index_1.Runtime.As(t.Unknown())),
|
|
129
142
|
index_1.Runtime.Const('void', index_1.Runtime.As(t.Void())),
|
|
130
143
|
]);
|
|
131
144
|
// ------------------------------------------------------------------
|
|
@@ -141,15 +154,18 @@ const KeyOf = index_1.Runtime.Union([
|
|
|
141
154
|
// IndexArray
|
|
142
155
|
// ------------------------------------------------------------------
|
|
143
156
|
// prettier-ignore
|
|
144
|
-
const IndexArrayMapping = (
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
const IndexArrayMapping = (results) => {
|
|
158
|
+
return results.reduce((result, current) => {
|
|
159
|
+
return current.length === 3
|
|
160
|
+
? [...result, [current[1]]]
|
|
161
|
+
: [...result, []];
|
|
162
|
+
}, []);
|
|
163
|
+
};
|
|
147
164
|
// prettier-ignore
|
|
148
|
-
const IndexArray = index_1.Runtime.Union([
|
|
149
|
-
index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RBracket)
|
|
150
|
-
index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Const(RBracket)
|
|
151
|
-
|
|
152
|
-
], value => IndexArrayMapping(value));
|
|
165
|
+
const IndexArray = index_1.Runtime.Array(index_1.Runtime.Union([
|
|
166
|
+
index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RBracket)]),
|
|
167
|
+
index_1.Runtime.Tuple([index_1.Runtime.Const(LBracket), index_1.Runtime.Const(RBracket)]),
|
|
168
|
+
]), IndexArrayMapping);
|
|
153
169
|
// ------------------------------------------------------------------
|
|
154
170
|
// Extends
|
|
155
171
|
// ------------------------------------------------------------------
|
|
@@ -168,50 +184,46 @@ const Extends = index_1.Runtime.Union([
|
|
|
168
184
|
// Base
|
|
169
185
|
// ------------------------------------------------------------------
|
|
170
186
|
// prettier-ignore
|
|
171
|
-
const BaseMapping = (
|
|
172
|
-
return
|
|
187
|
+
const BaseMapping = (value) => {
|
|
188
|
+
return t.ValueGuard.IsArray(value) && value.length === 3
|
|
189
|
+
? value[1]
|
|
190
|
+
: value;
|
|
173
191
|
};
|
|
174
192
|
// prettier-ignore
|
|
175
193
|
const Base = index_1.Runtime.Union([
|
|
176
|
-
index_1.Runtime.Tuple([
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
index_1.Runtime.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
index_1.Runtime.Ref('Uncapitalize'),
|
|
210
|
-
index_1.Runtime.Ref('Date'),
|
|
211
|
-
index_1.Runtime.Ref('Uint8Array'),
|
|
212
|
-
index_1.Runtime.Ref('GenericReference'),
|
|
213
|
-
index_1.Runtime.Ref('Reference')
|
|
214
|
-
])])
|
|
194
|
+
index_1.Runtime.Tuple([index_1.Runtime.Const(LParen), index_1.Runtime.Ref('Type'), index_1.Runtime.Const(RParen)]),
|
|
195
|
+
index_1.Runtime.Ref('Keyword'),
|
|
196
|
+
index_1.Runtime.Ref('Object'),
|
|
197
|
+
index_1.Runtime.Ref('Tuple'),
|
|
198
|
+
index_1.Runtime.Ref('Literal'),
|
|
199
|
+
index_1.Runtime.Ref('Constructor'),
|
|
200
|
+
index_1.Runtime.Ref('Function'),
|
|
201
|
+
index_1.Runtime.Ref('Mapped'),
|
|
202
|
+
index_1.Runtime.Ref('AsyncIterator'),
|
|
203
|
+
index_1.Runtime.Ref('Iterator'),
|
|
204
|
+
index_1.Runtime.Ref('ConstructorParameters'),
|
|
205
|
+
index_1.Runtime.Ref('FunctionParameters'),
|
|
206
|
+
index_1.Runtime.Ref('InstanceType'),
|
|
207
|
+
index_1.Runtime.Ref('ReturnType'),
|
|
208
|
+
index_1.Runtime.Ref('Argument'),
|
|
209
|
+
index_1.Runtime.Ref('Awaited'),
|
|
210
|
+
index_1.Runtime.Ref('Array'),
|
|
211
|
+
index_1.Runtime.Ref('Record'),
|
|
212
|
+
index_1.Runtime.Ref('Promise'),
|
|
213
|
+
index_1.Runtime.Ref('Partial'),
|
|
214
|
+
index_1.Runtime.Ref('Required'),
|
|
215
|
+
index_1.Runtime.Ref('Pick'),
|
|
216
|
+
index_1.Runtime.Ref('Omit'),
|
|
217
|
+
index_1.Runtime.Ref('Exclude'),
|
|
218
|
+
index_1.Runtime.Ref('Extract'),
|
|
219
|
+
index_1.Runtime.Ref('Uppercase'),
|
|
220
|
+
index_1.Runtime.Ref('Lowercase'),
|
|
221
|
+
index_1.Runtime.Ref('Capitalize'),
|
|
222
|
+
index_1.Runtime.Ref('Uncapitalize'),
|
|
223
|
+
index_1.Runtime.Ref('Date'),
|
|
224
|
+
index_1.Runtime.Ref('Uint8Array'),
|
|
225
|
+
index_1.Runtime.Ref('GenericReference'),
|
|
226
|
+
index_1.Runtime.Ref('Reference')
|
|
215
227
|
], BaseMapping);
|
|
216
228
|
// ------------------------------------------------------------------
|
|
217
229
|
// Factor
|
|
@@ -243,7 +255,7 @@ const Factor = index_1.Runtime.Tuple([
|
|
|
243
255
|
index_1.Runtime.Ref('Base'),
|
|
244
256
|
index_1.Runtime.Ref('IndexArray'),
|
|
245
257
|
index_1.Runtime.Ref('Extends')
|
|
246
|
-
],
|
|
258
|
+
], results => FactorMapping(...results));
|
|
247
259
|
// ------------------------------------------------------------------
|
|
248
260
|
// Expr
|
|
249
261
|
// ------------------------------------------------------------------
|
|
@@ -273,7 +285,7 @@ const ExprTermTail = index_1.Runtime.Union([
|
|
|
273
285
|
// prettier-ignore
|
|
274
286
|
const ExprTerm = index_1.Runtime.Tuple([
|
|
275
287
|
index_1.Runtime.Ref('Factor'), index_1.Runtime.Ref('ExprTermTail')
|
|
276
|
-
],
|
|
288
|
+
], results => ExprBinaryMapping(...results));
|
|
277
289
|
// prettier-ignore
|
|
278
290
|
const ExprTail = index_1.Runtime.Union([
|
|
279
291
|
index_1.Runtime.Tuple([index_1.Runtime.Const('|'), index_1.Runtime.Ref('ExprTerm'), index_1.Runtime.Ref('ExprTail')]),
|
|
@@ -282,7 +294,7 @@ const ExprTail = index_1.Runtime.Union([
|
|
|
282
294
|
// prettier-ignore
|
|
283
295
|
const Expr = index_1.Runtime.Tuple([
|
|
284
296
|
index_1.Runtime.Ref('ExprTerm'), index_1.Runtime.Ref('ExprTail')
|
|
285
|
-
],
|
|
297
|
+
], results => ExprBinaryMapping(...results));
|
|
286
298
|
// ------------------------------------------------------------------
|
|
287
299
|
// Type
|
|
288
300
|
// ------------------------------------------------------------------
|
|
@@ -292,7 +304,7 @@ const Type = index_1.Runtime.Union([
|
|
|
292
304
|
index_1.Runtime.Ref('Expr')
|
|
293
305
|
]);
|
|
294
306
|
// ------------------------------------------------------------------
|
|
295
|
-
//
|
|
307
|
+
// Property
|
|
296
308
|
// ------------------------------------------------------------------
|
|
297
309
|
const PropertyKey = index_1.Runtime.Union([index_1.Runtime.Ident(), index_1.Runtime.String([SingleQuote, DoubleQuote])]);
|
|
298
310
|
const Readonly = index_1.Runtime.Union([index_1.Runtime.Tuple([index_1.Runtime.Const('readonly')]), index_1.Runtime.Tuple([])], (value) => value.length > 0);
|
|
@@ -311,7 +323,10 @@ const Property = index_1.Runtime.Tuple([
|
|
|
311
323
|
index_1.Runtime.Ref('Optional'),
|
|
312
324
|
index_1.Runtime.Const(Colon),
|
|
313
325
|
index_1.Runtime.Ref('Type'),
|
|
314
|
-
],
|
|
326
|
+
], results => PropertyMapping(...results));
|
|
327
|
+
// ------------------------------------------------------------------
|
|
328
|
+
// PropertyDelimiter
|
|
329
|
+
// ------------------------------------------------------------------
|
|
315
330
|
// prettier-ignore
|
|
316
331
|
const PropertyDelimiter = index_1.Runtime.Union([
|
|
317
332
|
index_1.Runtime.Tuple([index_1.Runtime.Const(Comma), index_1.Runtime.Const(Newline)]),
|
|
@@ -320,63 +335,50 @@ const PropertyDelimiter = index_1.Runtime.Union([
|
|
|
320
335
|
index_1.Runtime.Tuple([index_1.Runtime.Const(SemiColon)]),
|
|
321
336
|
index_1.Runtime.Tuple([index_1.Runtime.Const(Newline)]),
|
|
322
337
|
]);
|
|
323
|
-
//
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ref('Property')]),
|
|
328
|
-
index_1.Runtime.Tuple([])
|
|
329
|
-
], values => (values.length === 3 ? { ...values[0], ...values[2] } :
|
|
330
|
-
values.length === 2 ? values[0] :
|
|
331
|
-
values.length === 1 ? values[0] :
|
|
332
|
-
{}));
|
|
338
|
+
// ------------------------------------------------------------------
|
|
339
|
+
// PropertyList
|
|
340
|
+
// ------------------------------------------------------------------
|
|
341
|
+
const PropertyList = Delimit(index_1.Runtime.Ref('Property'), index_1.Runtime.Ref('PropertyDelimiter'));
|
|
333
342
|
// ------------------------------------------------------------------
|
|
334
343
|
// Object
|
|
335
344
|
// ------------------------------------------------------------------
|
|
336
345
|
// prettier-ignore
|
|
337
|
-
const ObjectMapping = (
|
|
346
|
+
const ObjectMapping = (results) => {
|
|
347
|
+
const propertyList = results[1];
|
|
348
|
+
return t.Object(propertyList.reduce((result, property) => {
|
|
349
|
+
return { ...result, ...property };
|
|
350
|
+
}, {}));
|
|
351
|
+
};
|
|
338
352
|
// prettier-ignore
|
|
339
353
|
const _Object = index_1.Runtime.Tuple([
|
|
340
354
|
index_1.Runtime.Const(LBrace),
|
|
341
|
-
index_1.Runtime.Ref('
|
|
355
|
+
index_1.Runtime.Ref('PropertyList'),
|
|
342
356
|
index_1.Runtime.Const(RBrace)
|
|
343
|
-
],
|
|
357
|
+
], ObjectMapping);
|
|
358
|
+
// ------------------------------------------------------------------
|
|
359
|
+
// ElementList
|
|
360
|
+
// ------------------------------------------------------------------
|
|
361
|
+
const ElementList = Delimit(index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma));
|
|
344
362
|
// ------------------------------------------------------------------
|
|
345
363
|
// Tuple
|
|
346
364
|
// ------------------------------------------------------------------
|
|
347
365
|
// prettier-ignore
|
|
348
|
-
const Elements = index_1.Runtime.Union([
|
|
349
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma), index_1.Runtime.Ref('Elements')]),
|
|
350
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ref('Type'), index_1.Runtime.Const(Comma)]),
|
|
351
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ref('Type')]),
|
|
352
|
-
index_1.Runtime.Tuple([]),
|
|
353
|
-
], value => (value.length === 3 ? [value[0], ...value[2]] :
|
|
354
|
-
value.length === 2 ? [value[0]] :
|
|
355
|
-
value.length === 1 ? [value[0]] :
|
|
356
|
-
[]));
|
|
357
|
-
// prettier-ignore
|
|
358
366
|
const Tuple = index_1.Runtime.Tuple([
|
|
359
367
|
index_1.Runtime.Const(LBracket),
|
|
360
|
-
index_1.Runtime.Ref('
|
|
368
|
+
index_1.Runtime.Ref('ElementList'),
|
|
361
369
|
index_1.Runtime.Const(RBracket)
|
|
362
|
-
],
|
|
370
|
+
], results => t.Tuple(results[1]));
|
|
363
371
|
// ------------------------------------------------------------------
|
|
364
372
|
// Parameters
|
|
365
373
|
// ------------------------------------------------------------------
|
|
366
374
|
// prettier-ignore
|
|
367
375
|
const Parameter = index_1.Runtime.Tuple([
|
|
368
376
|
index_1.Runtime.Ident(), index_1.Runtime.Const(Colon), index_1.Runtime.Ref('Type')
|
|
369
|
-
],
|
|
370
|
-
//
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
index_1.Runtime.Tuple([index_1.Runtime.Ref('Parameter')]),
|
|
375
|
-
index_1.Runtime.Tuple([]),
|
|
376
|
-
], value => (value.length === 3 ? [value[0], ...value[2]] :
|
|
377
|
-
value.length === 2 ? [value[0]] :
|
|
378
|
-
value.length === 1 ? [value[0]] :
|
|
379
|
-
[]));
|
|
377
|
+
], results => results[2]);
|
|
378
|
+
// ------------------------------------------------------------------
|
|
379
|
+
// ParameterList
|
|
380
|
+
// ------------------------------------------------------------------
|
|
381
|
+
const ParameterList = Delimit(index_1.Runtime.Ref('Parameter'), index_1.Runtime.Const(Comma));
|
|
380
382
|
// ------------------------------------------------------------------
|
|
381
383
|
// Constructor
|
|
382
384
|
// ------------------------------------------------------------------
|
|
@@ -384,27 +386,27 @@ const Parameters = index_1.Runtime.Union([
|
|
|
384
386
|
const Constructor = index_1.Runtime.Tuple([
|
|
385
387
|
index_1.Runtime.Const('new'),
|
|
386
388
|
index_1.Runtime.Const(LParen),
|
|
387
|
-
index_1.Runtime.Ref('
|
|
389
|
+
index_1.Runtime.Ref('ParameterList'),
|
|
388
390
|
index_1.Runtime.Const(RParen),
|
|
389
391
|
index_1.Runtime.Const('=>'),
|
|
390
392
|
index_1.Runtime.Ref('Type')
|
|
391
|
-
],
|
|
393
|
+
], results => t.Constructor(results[2], results[5]));
|
|
392
394
|
// ------------------------------------------------------------------
|
|
393
395
|
// Function
|
|
394
396
|
// ------------------------------------------------------------------
|
|
395
397
|
// prettier-ignore
|
|
396
398
|
const Function = index_1.Runtime.Tuple([
|
|
397
399
|
index_1.Runtime.Const(LParen),
|
|
398
|
-
index_1.Runtime.Ref('
|
|
400
|
+
index_1.Runtime.Ref('ParameterList'),
|
|
399
401
|
index_1.Runtime.Const(RParen),
|
|
400
402
|
index_1.Runtime.Const('=>'),
|
|
401
403
|
index_1.Runtime.Ref('Type')
|
|
402
|
-
],
|
|
404
|
+
], results => t.Function(results[1], results[4]));
|
|
403
405
|
// ------------------------------------------------------------------
|
|
404
406
|
// Mapped (requires deferred types)
|
|
405
407
|
// ------------------------------------------------------------------
|
|
406
408
|
// prettier-ignore
|
|
407
|
-
const MappedMapping = (
|
|
409
|
+
const MappedMapping = (results) => {
|
|
408
410
|
return t.Literal('Mapped types not supported');
|
|
409
411
|
};
|
|
410
412
|
// prettier-ignore
|
|
@@ -428,7 +430,7 @@ const AsyncIterator = index_1.Runtime.Tuple([
|
|
|
428
430
|
index_1.Runtime.Const(LAngle),
|
|
429
431
|
index_1.Runtime.Ref('Type'),
|
|
430
432
|
index_1.Runtime.Const(RAngle),
|
|
431
|
-
],
|
|
433
|
+
], results => t.AsyncIterator(results[2]));
|
|
432
434
|
// ------------------------------------------------------------------
|
|
433
435
|
// Iterator
|
|
434
436
|
// ------------------------------------------------------------------
|
|
@@ -438,7 +440,7 @@ const Iterator = index_1.Runtime.Tuple([
|
|
|
438
440
|
index_1.Runtime.Const(LAngle),
|
|
439
441
|
index_1.Runtime.Ref('Type'),
|
|
440
442
|
index_1.Runtime.Const(RAngle),
|
|
441
|
-
],
|
|
443
|
+
], results => t.Iterator(results[2]));
|
|
442
444
|
// ------------------------------------------------------------------
|
|
443
445
|
// ConstructorParameters
|
|
444
446
|
// ------------------------------------------------------------------
|
|
@@ -448,7 +450,7 @@ const ConstructorParameters = index_1.Runtime.Tuple([
|
|
|
448
450
|
index_1.Runtime.Const(LAngle),
|
|
449
451
|
index_1.Runtime.Ref('Type'),
|
|
450
452
|
index_1.Runtime.Const(RAngle),
|
|
451
|
-
],
|
|
453
|
+
], results => t.ConstructorParameters(results[2]));
|
|
452
454
|
// ------------------------------------------------------------------
|
|
453
455
|
// Parameters
|
|
454
456
|
// ------------------------------------------------------------------
|
|
@@ -458,7 +460,7 @@ const FunctionParameters = index_1.Runtime.Tuple([
|
|
|
458
460
|
index_1.Runtime.Const(LAngle),
|
|
459
461
|
index_1.Runtime.Ref('Type'),
|
|
460
462
|
index_1.Runtime.Const(RAngle),
|
|
461
|
-
],
|
|
463
|
+
], results => t.Parameters(results[2]));
|
|
462
464
|
// ------------------------------------------------------------------
|
|
463
465
|
// InstanceType
|
|
464
466
|
// ------------------------------------------------------------------
|
|
@@ -468,7 +470,7 @@ const InstanceType = index_1.Runtime.Tuple([
|
|
|
468
470
|
index_1.Runtime.Const(LAngle),
|
|
469
471
|
index_1.Runtime.Ref('Type'),
|
|
470
472
|
index_1.Runtime.Const(RAngle),
|
|
471
|
-
],
|
|
473
|
+
], results => t.InstanceType(results[2]));
|
|
472
474
|
// ------------------------------------------------------------------
|
|
473
475
|
// ReturnType
|
|
474
476
|
// ------------------------------------------------------------------
|
|
@@ -478,7 +480,7 @@ const ReturnType = index_1.Runtime.Tuple([
|
|
|
478
480
|
index_1.Runtime.Const(LAngle),
|
|
479
481
|
index_1.Runtime.Ref('Type'),
|
|
480
482
|
index_1.Runtime.Const(RAngle),
|
|
481
|
-
],
|
|
483
|
+
], results => t.ReturnType(results[2]));
|
|
482
484
|
// ------------------------------------------------------------------
|
|
483
485
|
// Argument
|
|
484
486
|
// ------------------------------------------------------------------
|
|
@@ -502,7 +504,7 @@ const Awaited = index_1.Runtime.Tuple([
|
|
|
502
504
|
index_1.Runtime.Const(LAngle),
|
|
503
505
|
index_1.Runtime.Ref('Type'),
|
|
504
506
|
index_1.Runtime.Const(RAngle),
|
|
505
|
-
],
|
|
507
|
+
], results => t.Awaited(results[2]));
|
|
506
508
|
// ------------------------------------------------------------------
|
|
507
509
|
// Array
|
|
508
510
|
// ------------------------------------------------------------------
|
|
@@ -512,7 +514,7 @@ const Array = index_1.Runtime.Tuple([
|
|
|
512
514
|
index_1.Runtime.Const(LAngle),
|
|
513
515
|
index_1.Runtime.Ref('Type'),
|
|
514
516
|
index_1.Runtime.Const(RAngle),
|
|
515
|
-
],
|
|
517
|
+
], results => t.Array(results[2]));
|
|
516
518
|
// ------------------------------------------------------------------
|
|
517
519
|
// Record
|
|
518
520
|
// ------------------------------------------------------------------
|
|
@@ -524,7 +526,7 @@ const Record = index_1.Runtime.Tuple([
|
|
|
524
526
|
index_1.Runtime.Const(Comma),
|
|
525
527
|
index_1.Runtime.Ref('Type'),
|
|
526
528
|
index_1.Runtime.Const(RAngle),
|
|
527
|
-
],
|
|
529
|
+
], results => t.Record(results[2], results[4]));
|
|
528
530
|
// ------------------------------------------------------------------
|
|
529
531
|
// Promise
|
|
530
532
|
// ------------------------------------------------------------------
|
|
@@ -534,7 +536,7 @@ const Promise = index_1.Runtime.Tuple([
|
|
|
534
536
|
index_1.Runtime.Const(LAngle),
|
|
535
537
|
index_1.Runtime.Ref('Type'),
|
|
536
538
|
index_1.Runtime.Const(RAngle),
|
|
537
|
-
],
|
|
539
|
+
], results => t.Promise(results[2]));
|
|
538
540
|
// ------------------------------------------------------------------
|
|
539
541
|
// Partial
|
|
540
542
|
// ------------------------------------------------------------------
|
|
@@ -544,7 +546,7 @@ const Partial = index_1.Runtime.Tuple([
|
|
|
544
546
|
index_1.Runtime.Const(LAngle),
|
|
545
547
|
index_1.Runtime.Ref('Type'),
|
|
546
548
|
index_1.Runtime.Const(RAngle),
|
|
547
|
-
],
|
|
549
|
+
], results => t.Partial(results[2]));
|
|
548
550
|
// ------------------------------------------------------------------
|
|
549
551
|
// Required
|
|
550
552
|
// ------------------------------------------------------------------
|
|
@@ -554,7 +556,7 @@ const Required = index_1.Runtime.Tuple([
|
|
|
554
556
|
index_1.Runtime.Const(LAngle),
|
|
555
557
|
index_1.Runtime.Ref('Type'),
|
|
556
558
|
index_1.Runtime.Const(RAngle),
|
|
557
|
-
],
|
|
559
|
+
], results => t.Required(results[2]));
|
|
558
560
|
// ------------------------------------------------------------------
|
|
559
561
|
// Pick
|
|
560
562
|
// ------------------------------------------------------------------
|
|
@@ -566,7 +568,7 @@ const Pick = index_1.Runtime.Tuple([
|
|
|
566
568
|
index_1.Runtime.Const(Comma),
|
|
567
569
|
index_1.Runtime.Ref('Type'),
|
|
568
570
|
index_1.Runtime.Const(RAngle),
|
|
569
|
-
],
|
|
571
|
+
], results => t.Pick(results[2], results[4]));
|
|
570
572
|
// ------------------------------------------------------------------
|
|
571
573
|
// Omit
|
|
572
574
|
// ------------------------------------------------------------------
|
|
@@ -578,7 +580,7 @@ const Omit = index_1.Runtime.Tuple([
|
|
|
578
580
|
index_1.Runtime.Const(Comma),
|
|
579
581
|
index_1.Runtime.Ref('Type'),
|
|
580
582
|
index_1.Runtime.Const(RAngle),
|
|
581
|
-
],
|
|
583
|
+
], results => t.Omit(results[2], results[4]));
|
|
582
584
|
// ------------------------------------------------------------------
|
|
583
585
|
// Exclude
|
|
584
586
|
// ------------------------------------------------------------------
|
|
@@ -590,7 +592,7 @@ const Exclude = index_1.Runtime.Tuple([
|
|
|
590
592
|
index_1.Runtime.Const(Comma),
|
|
591
593
|
index_1.Runtime.Ref('Type'),
|
|
592
594
|
index_1.Runtime.Const(RAngle),
|
|
593
|
-
],
|
|
595
|
+
], results => t.Exclude(results[2], results[4]));
|
|
594
596
|
// ------------------------------------------------------------------
|
|
595
597
|
// Extract
|
|
596
598
|
// ------------------------------------------------------------------
|
|
@@ -602,7 +604,7 @@ const Extract = index_1.Runtime.Tuple([
|
|
|
602
604
|
index_1.Runtime.Const(Comma),
|
|
603
605
|
index_1.Runtime.Ref('Type'),
|
|
604
606
|
index_1.Runtime.Const(RAngle),
|
|
605
|
-
],
|
|
607
|
+
], results => t.Extract(results[2], results[4]));
|
|
606
608
|
// ------------------------------------------------------------------
|
|
607
609
|
// Uppercase
|
|
608
610
|
// ------------------------------------------------------------------
|
|
@@ -612,7 +614,7 @@ const Uppercase = index_1.Runtime.Tuple([
|
|
|
612
614
|
index_1.Runtime.Const(LAngle),
|
|
613
615
|
index_1.Runtime.Ref('Type'),
|
|
614
616
|
index_1.Runtime.Const(RAngle),
|
|
615
|
-
],
|
|
617
|
+
], results => t.Uppercase(results[2]));
|
|
616
618
|
// ------------------------------------------------------------------
|
|
617
619
|
// Lowercase
|
|
618
620
|
// ------------------------------------------------------------------
|
|
@@ -622,7 +624,7 @@ const Lowercase = index_1.Runtime.Tuple([
|
|
|
622
624
|
index_1.Runtime.Const(LAngle),
|
|
623
625
|
index_1.Runtime.Ref('Type'),
|
|
624
626
|
index_1.Runtime.Const(RAngle),
|
|
625
|
-
],
|
|
627
|
+
], results => t.Lowercase(results[2]));
|
|
626
628
|
// ------------------------------------------------------------------
|
|
627
629
|
// Capitalize
|
|
628
630
|
// ------------------------------------------------------------------
|
|
@@ -632,7 +634,7 @@ const Capitalize = index_1.Runtime.Tuple([
|
|
|
632
634
|
index_1.Runtime.Const(LAngle),
|
|
633
635
|
index_1.Runtime.Ref('Type'),
|
|
634
636
|
index_1.Runtime.Const(RAngle),
|
|
635
|
-
],
|
|
637
|
+
], results => t.Capitalize(results[2]));
|
|
636
638
|
// ------------------------------------------------------------------
|
|
637
639
|
// Uncapitalize
|
|
638
640
|
// ------------------------------------------------------------------
|
|
@@ -642,7 +644,7 @@ const Uncapitalize = index_1.Runtime.Tuple([
|
|
|
642
644
|
index_1.Runtime.Const(LAngle),
|
|
643
645
|
index_1.Runtime.Ref('Type'),
|
|
644
646
|
index_1.Runtime.Const(RAngle),
|
|
645
|
-
],
|
|
647
|
+
], results => t.Uncapitalize(results[2]));
|
|
646
648
|
// ------------------------------------------------------------------
|
|
647
649
|
// Date
|
|
648
650
|
// ------------------------------------------------------------------
|
|
@@ -656,14 +658,8 @@ const Uint8Array = index_1.Runtime.Const('Uint8Array', index_1.Runtime.As(t.Uint
|
|
|
656
658
|
// ------------------------------------------------------------------
|
|
657
659
|
// prettier-ignore
|
|
658
660
|
exports.Module = new index_1.Runtime.Module({
|
|
659
|
-
|
|
660
|
-
// Generics
|
|
661
|
-
// ----------------------------------------------------------------
|
|
662
|
-
GenericArgumentList,
|
|
661
|
+
GenericArgumentsList,
|
|
663
662
|
GenericArguments,
|
|
664
|
-
// ----------------------------------------------------------------
|
|
665
|
-
// Type
|
|
666
|
-
// ----------------------------------------------------------------
|
|
667
663
|
Literal,
|
|
668
664
|
Keyword,
|
|
669
665
|
KeyOf,
|
|
@@ -681,13 +677,13 @@ exports.Module = new index_1.Runtime.Module({
|
|
|
681
677
|
Optional,
|
|
682
678
|
Property,
|
|
683
679
|
PropertyDelimiter,
|
|
684
|
-
|
|
680
|
+
PropertyList,
|
|
685
681
|
Object: _Object,
|
|
686
|
-
|
|
682
|
+
ElementList,
|
|
687
683
|
Tuple,
|
|
688
684
|
Parameter,
|
|
685
|
+
ParameterList,
|
|
689
686
|
Function,
|
|
690
|
-
Parameters,
|
|
691
687
|
Constructor,
|
|
692
688
|
Mapped,
|
|
693
689
|
AsyncIterator,
|
|
@@ -713,6 +709,7 @@ exports.Module = new index_1.Runtime.Module({
|
|
|
713
709
|
Uncapitalize,
|
|
714
710
|
Date,
|
|
715
711
|
Uint8Array,
|
|
712
|
+
GenericReferenceParameters,
|
|
716
713
|
GenericReference,
|
|
717
714
|
Reference,
|
|
718
715
|
});
|