@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.8
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/dist/Glutinum.Converter/GlueAST.js +3 -2
- package/dist/Glutinum.Converter/Hosting.js +2 -2
- package/dist/Glutinum.Converter/Packages.js +13 -22
- package/dist/Glutinum.Converter/Read.js +103 -140
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +53 -5
- package/dist/Glutinum.Converter/Reader/Node.js +3 -3
- package/dist/Glutinum.Converter/Reader/Parameters.js +3 -2
- package/dist/Glutinum.Converter/Reader/TypeNode.js +102 -1941
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +53 -14
- package/dist/Glutinum.Converter/Reader/Types.js +5 -0
- package/dist/Glutinum.Converter/Reader/UtilityType.js +803 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +149 -78
- package/dist/Glutinum.Converter/Transform.js +274 -1163
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +2 -64
- package/dist/Glutinum.Converter/Transformer/Context.js +23 -10
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/Heritage.js +89 -2
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/package.json +1 -1
|
@@ -1,1613 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { Exception,
|
|
15
|
-
import { ts } from "@ts-morph/bootstrap";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
constructor(tag, fields) {
|
|
24
|
-
super();
|
|
25
|
-
this.tag = tag;
|
|
26
|
-
this.fields = fields;
|
|
27
|
-
}
|
|
28
|
-
cases() {
|
|
29
|
-
return ["Single", "WithoutDeclaration", "ForceAny"];
|
|
30
|
-
}
|
|
31
|
-
static ForceAny = new IntersectionTypePropertyResult(2, []);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function IntersectionTypePropertyResult_$reflection() {
|
|
35
|
-
return union_type("Glutinum.Converter.Reader.TypeNode.IntersectionTypePropertyResult", [], IntersectionTypePropertyResult, () => [[["Item1", class_type("TypeScript.Ts.Symbol")], ["Item2", class_type("TypeScript.Ts.Declaration")]], [["Item", class_type("TypeScript.Ts.Symbol")]], []]);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function landingOf(reader, node) {
|
|
39
|
-
if (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing.length === 0) {
|
|
40
|
-
return node;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return item_4(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing.length - 1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function readPropertyWithoutDeclaration(reader, contextNode, property) {
|
|
48
|
-
let matchValue_1;
|
|
49
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeOfSymbol(property);
|
|
50
|
-
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
|
|
51
|
-
if (matchValue == null) {
|
|
52
|
-
const item = Report_readerError_Z19516DCE("type node", concat("Could not resolve the type of the property \'", property.name, "\'"), contextNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 59);
|
|
53
|
-
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
54
|
-
void (objectArg.push(item));
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
const typeNode = matchValue;
|
|
59
|
-
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
60
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
|
|
61
|
-
let propertyType;
|
|
62
|
-
try {
|
|
63
|
-
propertyType = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
64
|
-
}
|
|
65
|
-
finally {
|
|
66
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
67
|
-
}
|
|
68
|
-
return new GlueMember(/* Property */ 1, [new GlueProperty(property.name, empty(), propertyType, false, (matchValue_1 = property.flags, $007CHasSymbolFlags$007C_$007C(16777216, matchValue_1) != null), GlueAccessor.ReadWrite, false)]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function readInstantiatedMember(reader, contextNode, property, declaration) {
|
|
73
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
74
|
-
const instantiatedType = checker.getTypeOfSymbol(property);
|
|
75
|
-
const isInstantiated = !Operators_IsNull(declaration.symbol) && !(instantiatedType === checker.getTypeOfSymbol(declaration.symbol));
|
|
76
|
-
const declaredMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration);
|
|
77
|
-
if (!isInstantiated) {
|
|
78
|
-
return declaredMember;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const matchValue = checker.typeToTypeNode(instantiatedType, enclosingDeclarationOf(contextNode), typeNodeBuilderFlags);
|
|
82
|
-
if (matchValue != null) {
|
|
83
|
-
const typeNode = matchValue;
|
|
84
|
-
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
85
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
|
|
86
|
-
let instantiatedMember;
|
|
87
|
-
try {
|
|
88
|
-
instantiatedMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
89
|
-
}
|
|
90
|
-
finally {
|
|
91
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
92
|
-
}
|
|
93
|
-
let matchResult, info, typ, functionType, info_1, functionType_1, info_2, declaredMember_1;
|
|
94
|
-
switch (declaredMember.tag) {
|
|
95
|
-
case 1: {
|
|
96
|
-
matchResult = 0;
|
|
97
|
-
info = declaredMember.fields[0];
|
|
98
|
-
typ = instantiatedMember;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
case 6: {
|
|
102
|
-
if (instantiatedMember.tag === 15) {
|
|
103
|
-
matchResult = 1;
|
|
104
|
-
functionType = instantiatedMember.fields[0];
|
|
105
|
-
info_1 = declaredMember.fields[0];
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
matchResult = 3;
|
|
109
|
-
declaredMember_1 = declaredMember;
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
case 0: {
|
|
114
|
-
if (instantiatedMember.tag === 15) {
|
|
115
|
-
matchResult = 2;
|
|
116
|
-
functionType_1 = instantiatedMember.fields[0];
|
|
117
|
-
info_2 = declaredMember.fields[0];
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
matchResult = 3;
|
|
121
|
-
declaredMember_1 = declaredMember;
|
|
122
|
-
}
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
default: {
|
|
126
|
-
matchResult = 3;
|
|
127
|
-
declaredMember_1 = declaredMember;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
switch (matchResult) {
|
|
131
|
-
case 0:
|
|
132
|
-
return new GlueMember(/* Property */ 1, [new GlueProperty(info.Name, info.Documentation, typ, info.IsStatic, info.IsOptional, info.Accessor, info.IsPrivate)]);
|
|
133
|
-
case 1:
|
|
134
|
-
return new GlueMember(/* MethodSignature */ 6, [new GlueMethodSignature(info_1.Name, info_1.Documentation, info_1.TypeParameters, functionType.Parameters, functionType.Type, info_1.IsOptional)]);
|
|
135
|
-
case 2:
|
|
136
|
-
return new GlueMember(/* Method */ 0, [new GlueMethod(info_2.Name, info_2.Documentation, info_2.TypeParameters, functionType_1.Parameters, functionType_1.Type, info_2.IsOptional, info_2.IsStatic)]);
|
|
137
|
-
default:
|
|
138
|
-
return declaredMember_1;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
return declaredMember;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function isLibraryName(reader, name) {
|
|
148
|
-
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
149
|
-
if (matchValue == null) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return matchValue.IsLibraryName(name);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function isDeferredConditional(typ) {
|
|
158
|
-
const matchValue = typ.flags;
|
|
159
|
-
if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function isParseTreeNode(node) {
|
|
168
|
-
return (node.flags & 16) === 0;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function typeParametersInScope(reader, typeNode) {
|
|
172
|
-
const collect = (node_mut, acc_mut) => {
|
|
173
|
-
collect:
|
|
174
|
-
while (true) {
|
|
175
|
-
const node = node_mut, acc = acc_mut;
|
|
176
|
-
let option_1;
|
|
177
|
-
if (Operators_IsNull(node)) {
|
|
178
|
-
return reverse(acc);
|
|
179
|
-
}
|
|
180
|
-
else if (((Operators_IsNull(node.parent) && (node.pos < 0)) && (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]() != null)) && !(node === value_6(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]()))) {
|
|
181
|
-
node_mut = value_6(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]());
|
|
182
|
-
acc_mut = acc;
|
|
183
|
-
continue collect;
|
|
184
|
-
}
|
|
185
|
-
else if (node.kind === 266) {
|
|
186
|
-
return reverse(acc);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
const own_1 = defaultArg((option_1 = (isParseTreeNode(node) ? node.typeParameters : undefined), (option_1 != null) ? toList(option_1) : undefined), empty());
|
|
190
|
-
node_mut = node.parent;
|
|
191
|
-
acc_mut = append(reverse(own_1), acc);
|
|
192
|
-
continue collect;
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
return collect(typeNode.parent, empty());
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function isDeclaredByType(typeParameter) {
|
|
201
|
-
const parent = typeParameter.parent;
|
|
202
|
-
if (!Operators_IsNull(parent)) {
|
|
203
|
-
const matchValue = parent.kind;
|
|
204
|
-
switch (matchValue) {
|
|
205
|
-
case 232:
|
|
206
|
-
case 264:
|
|
207
|
-
case 265:
|
|
208
|
-
return true;
|
|
209
|
-
default:
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function boundTypeParameters(reader, typeNode) {
|
|
219
|
-
return fold((bound, typeParameter) => {
|
|
220
|
-
let constraint_, default_;
|
|
221
|
-
const name = identifierText(typeParameter.name);
|
|
222
|
-
let binding;
|
|
223
|
-
const matchValue = typeParameter.default;
|
|
224
|
-
const matchValue_1 = typeParameter.constraint;
|
|
225
|
-
let matchResult, default__1, constraint__1;
|
|
226
|
-
if (matchValue == null) {
|
|
227
|
-
if (matchValue_1 != null) {
|
|
228
|
-
if ((constraint_ = matchValue_1, constraint_.kind !== 199)) {
|
|
229
|
-
matchResult = 2;
|
|
230
|
-
constraint__1 = matchValue_1;
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
matchResult = 3;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
matchResult = 3;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
else if ((default_ = matchValue, isDeclaredByType(typeParameter) && (default_.kind !== 133))) {
|
|
241
|
-
matchResult = 0;
|
|
242
|
-
default__1 = matchValue;
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
matchResult = 1;
|
|
246
|
-
}
|
|
247
|
-
switch (matchResult) {
|
|
248
|
-
case 0: {
|
|
249
|
-
binding = default__1;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
case 1: {
|
|
253
|
-
binding = undefined;
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case 2: {
|
|
257
|
-
binding = constraint__1;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
default:
|
|
261
|
-
binding = undefined;
|
|
262
|
-
}
|
|
263
|
-
let matchResult_1, binding_2;
|
|
264
|
-
if (binding != null) {
|
|
265
|
-
if (!FSharpMap__ContainsKey(bound, name)) {
|
|
266
|
-
matchResult_1 = 0;
|
|
267
|
-
binding_2 = binding;
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
matchResult_1 = 1;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
matchResult_1 = 1;
|
|
275
|
-
}
|
|
276
|
-
switch (matchResult_1) {
|
|
277
|
-
case 0:
|
|
278
|
-
return FSharpMap__Add(bound, name, binding_2);
|
|
279
|
-
default:
|
|
280
|
-
return bound;
|
|
281
|
-
}
|
|
282
|
-
}, empty_1({
|
|
283
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
284
|
-
}), typeParametersInScope(reader, typeNode));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function isAnyTypeParameter(reader, typeNode) {
|
|
288
|
-
let option_1, _arg;
|
|
289
|
-
if (typeNode.kind === 184) {
|
|
290
|
-
const typeName = typeNode.typeName;
|
|
291
|
-
if (typeName.kind === 80) {
|
|
292
|
-
return exists((default_) => (default_.kind === 133), toArray((option_1 = tryFind((typeParameter) => (identifierText(typeParameter.name) === identifierText(typeName)), typeParametersInScope(reader, typeNode)), (option_1 != null) ? ((_arg = option_1, _arg.default)) : undefined)));
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function mentionsBoundTypeParameter(bindings, typeNode) {
|
|
304
|
-
let option_1;
|
|
305
|
-
const mentions = (typeNode_1) => mentionsBoundTypeParameter(bindings, typeNode_1);
|
|
306
|
-
const matchValue = typeNode.kind;
|
|
307
|
-
switch (matchValue) {
|
|
308
|
-
case 184: {
|
|
309
|
-
const typeReferenceNode = typeNode;
|
|
310
|
-
const typeName = typeReferenceNode.typeName;
|
|
311
|
-
if ((typeName.kind === 80) && FSharpMap__ContainsKey(bindings, identifierText(typeName))) {
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
return defaultArg((option_1 = typeReferenceNode.typeArguments, (option_1 != null) ? exists(mentions, option_1) : undefined), false);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
case 189:
|
|
319
|
-
return mentions(typeNode.elementType);
|
|
320
|
-
case 193:
|
|
321
|
-
return exists(mentions, typeNode.types);
|
|
322
|
-
case 195: {
|
|
323
|
-
const conditionalTypeNode = typeNode;
|
|
324
|
-
if ((mentions(conditionalTypeNode.checkType) ? true : mentions(conditionalTypeNode.extendsType)) ? true : mentions(conditionalTypeNode.trueType)) {
|
|
325
|
-
return true;
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
return mentions(conditionalTypeNode.falseType);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
case 200: {
|
|
332
|
-
const indexedAccessTypeNode = typeNode;
|
|
333
|
-
if (mentions(indexedAccessTypeNode.objectType)) {
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
return mentions(indexedAccessTypeNode.indexType);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
default:
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function substituteBoundTypeParameters(bindings, typeNode) {
|
|
346
|
-
const substitute = (typeNode_1) => substituteBoundTypeParameters(bindings, typeNode_1);
|
|
347
|
-
const adopt = (synthesized) => ((function (ts, node, like, flag) {
|
|
348
|
-
Object.assign(node, { flags: node.flags & ~flag, pos: like.pos, end: like.end, parent: like.parent });
|
|
349
|
-
ts.forEachChild(node, function (child) {
|
|
350
|
-
if ((child.flags & flag) !== 0 && !child.parent) {
|
|
351
|
-
Object.assign(child, { flags: child.flags & ~flag, pos: like.pos, end: like.end, parent: node });
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
return node;
|
|
355
|
-
})(ts, synthesized, typeNode, 16));
|
|
356
|
-
const matchValue = typeNode.kind;
|
|
357
|
-
switch (matchValue) {
|
|
358
|
-
case 184: {
|
|
359
|
-
const typeReferenceNode = typeNode;
|
|
360
|
-
const typeName = typeReferenceNode.typeName;
|
|
361
|
-
const matchValue_1 = typeReferenceNode.typeArguments;
|
|
362
|
-
if (matchValue_1 != null) {
|
|
363
|
-
const typeArguments = matchValue_1;
|
|
364
|
-
return adopt((ts.factory).createTypeReferenceNode(typeReferenceNode.typeName, Array.from(map(substitute, typeArguments))));
|
|
365
|
-
}
|
|
366
|
-
else if (typeName.kind === 80) {
|
|
367
|
-
return defaultArg(FSharpMap__TryFind(bindings, identifierText(typeName)), typeNode);
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
return typeNode;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
case 189:
|
|
374
|
-
return adopt((ts.factory).createArrayTypeNode(substitute(typeNode.elementType)));
|
|
375
|
-
case 193:
|
|
376
|
-
return adopt((ts.factory).createUnionTypeNode(Array.from(map(substitute, typeNode.types))));
|
|
377
|
-
case 195: {
|
|
378
|
-
const conditionalTypeNode = typeNode;
|
|
379
|
-
return adopt((ts.factory).createConditionalTypeNode(substitute(conditionalTypeNode.checkType), substitute(conditionalTypeNode.extendsType), substitute(conditionalTypeNode.trueType), substitute(conditionalTypeNode.falseType)));
|
|
380
|
-
}
|
|
381
|
-
case 200: {
|
|
382
|
-
const indexedAccessTypeNode = typeNode;
|
|
383
|
-
return adopt((ts.factory).createIndexedAccessTypeNode(substitute(indexedAccessTypeNode.objectType), substitute(indexedAccessTypeNode.indexType)));
|
|
384
|
-
}
|
|
385
|
-
default:
|
|
386
|
-
return typeNode;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function deferredConditionals(checker, depth, typ) {
|
|
391
|
-
let depth_1;
|
|
392
|
-
const matchValue = typ.flags;
|
|
393
|
-
if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
394
|
-
return singleton(typ);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
let matchResult;
|
|
398
|
-
if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
|
|
399
|
-
matchResult = 0;
|
|
400
|
-
}
|
|
401
|
-
else if ($007CHasTypeFlags$007C_$007C(268435456, matchValue) != null) {
|
|
402
|
-
matchResult = 0;
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
matchResult = 1;
|
|
406
|
-
}
|
|
407
|
-
switch (matchResult) {
|
|
408
|
-
case 0:
|
|
409
|
-
return collect_1((typ_1) => deferredConditionals(checker, depth, typ_1), toList(typ.types));
|
|
410
|
-
default: {
|
|
411
|
-
let matchResult_1;
|
|
412
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
|
|
413
|
-
if ((depth < 8) && ((typ.objectFlags & 4) !== 0)) {
|
|
414
|
-
matchResult_1 = 0;
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
matchResult_1 = 1;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
matchResult_1 = 1;
|
|
422
|
-
}
|
|
423
|
-
switch (matchResult_1) {
|
|
424
|
-
case 0:
|
|
425
|
-
return collect_1((depth_1 = ((depth + 1) | 0), (typ_2) => deferredConditionals(checker, depth_1, typ_2)), toList(checker.getTypeArguments(typ)));
|
|
426
|
-
default:
|
|
427
|
-
return empty();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
function mentionedTypes(checker, depth, typ) {
|
|
435
|
-
let option_1, matchValue, indexedAccess, conditional;
|
|
436
|
-
let mentioned;
|
|
437
|
-
const depth_1 = (depth + 1) | 0;
|
|
438
|
-
mentioned = ((typ_1) => mentionedTypes(checker, depth_1, typ_1));
|
|
439
|
-
if (depth > 8) {
|
|
440
|
-
return empty();
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
return append(cons(typ, defaultArg((option_1 = typ.aliasTypeArguments, (option_1 != null) ? collect_1(mentioned, toList(option_1)) : undefined), empty())), (matchValue = typ.flags, ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) ? collect_1(mentioned, toList(typ.types)) : (($007CHasTypeFlags$007C_$007C(268435456, matchValue) != null) ? collect_1(mentioned, toList(typ.types)) : (($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) ? (((typ.objectFlags & 4) !== 0) ? collect_1(mentioned, toList(checker.getTypeArguments(typ))) : (($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) ? mentioned(typ.type) : (($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) ? ((indexedAccess = typ, append(mentioned(indexedAccess.objectType), mentioned(indexedAccess.indexType)))) : (($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) ? ((conditional = typ, append(mentioned(conditional.checkType), mentioned(conditional.extendsType)))) : empty())))) : (($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) ? mentioned(typ.type) : (($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) ? ((indexedAccess = typ, append(mentioned(indexedAccess.objectType), mentioned(indexedAccess.indexType)))) : (($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) ? ((conditional = typ, append(mentioned(conditional.checkType), mentioned(conditional.extendsType)))) : empty())))))));
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
function typeParameterNamesOf(checker, typ) {
|
|
448
|
-
return choose((mentioned) => {
|
|
449
|
-
const matchValue = mentioned.flags;
|
|
450
|
-
if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
|
|
451
|
-
return mentioned.symbol.name;
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
return undefined;
|
|
455
|
-
}
|
|
456
|
-
}, mentionedTypes(checker, 0, typ));
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function isStillBound(checker, bound, typ) {
|
|
460
|
-
const substitutes = toList(map((node_1) => checker.getTypeFromTypeNode(node_1), filter((node) => (node.kind === 184), FSharpMap__get_Values(bound))));
|
|
461
|
-
const mentioned = mentionedTypes(checker, 0, typ);
|
|
462
|
-
return exists_1((substitute) => exists_1((typ_1) => (typ_1 === substitute), mentioned), substitutes);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function resolveWithBindings(checker_mut, typeNode_mut, bindings_mut, bound_mut, typ_mut) {
|
|
466
|
-
resolveWithBindings:
|
|
467
|
-
while (true) {
|
|
468
|
-
const checker = checker_mut, typeNode = typeNode_mut, bindings = bindings_mut, bound = bound_mut, typ = typ_mut;
|
|
469
|
-
const conditionals = deferredConditionals(checker, 0, typ);
|
|
470
|
-
if (isEmpty(conditionals)) {
|
|
471
|
-
if (isStillBound(checker, bound, typ)) {
|
|
472
|
-
return undefined;
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
return typ;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
const alreadyBound = FSharpMap__get_Count(bound) | 0;
|
|
480
|
-
const bound_3 = fold((bound_1, conditional) => fold((bound_2, name) => {
|
|
481
|
-
const matchValue = FSharpMap__TryFind(bindings, name);
|
|
482
|
-
let matchResult, binding_1;
|
|
483
|
-
if (matchValue != null) {
|
|
484
|
-
if (!FSharpMap__ContainsKey(bound_2, name)) {
|
|
485
|
-
matchResult = 0;
|
|
486
|
-
binding_1 = matchValue;
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
matchResult = 1;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
matchResult = 1;
|
|
494
|
-
}
|
|
495
|
-
switch (matchResult) {
|
|
496
|
-
case 0:
|
|
497
|
-
return FSharpMap__Add(bound_2, name, binding_1);
|
|
498
|
-
default:
|
|
499
|
-
return bound_2;
|
|
500
|
-
}
|
|
501
|
-
}, bound_1, append(typeParameterNamesOf(checker, conditional.checkType), typeParameterNamesOf(checker, conditional.extendsType))), bound, conditionals);
|
|
502
|
-
if ((FSharpMap__get_Count(bound_3) === alreadyBound) ? true : !mentionsBoundTypeParameter(bound_3, typeNode)) {
|
|
503
|
-
return undefined;
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
checker_mut = checker;
|
|
507
|
-
typeNode_mut = typeNode;
|
|
508
|
-
bindings_mut = bindings;
|
|
509
|
-
bound_mut = bound_3;
|
|
510
|
-
typ_mut = checker.getTypeFromTypeNode(substituteBoundTypeParameters(bound_3, typeNode));
|
|
511
|
-
continue resolveWithBindings;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
function standsForConditional(checker_mut, visited_mut, node_mut) {
|
|
519
|
-
standsForConditional:
|
|
520
|
-
while (true) {
|
|
521
|
-
const checker = checker_mut, visited = visited_mut, node = node_mut;
|
|
522
|
-
let option_3;
|
|
523
|
-
const matchValue = node.kind;
|
|
524
|
-
switch (matchValue) {
|
|
525
|
-
case 184: {
|
|
526
|
-
const typeReferenceNode = node;
|
|
527
|
-
let matchValue_1;
|
|
528
|
-
const option_1 = symbolAtLocation(checker, typeReferenceNode.typeName);
|
|
529
|
-
matchValue_1 = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
|
|
530
|
-
if (matchValue_1 == null) {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
const symbol_1 = matchValue_1;
|
|
535
|
-
const key = checker.getFullyQualifiedName(symbol_1);
|
|
536
|
-
if (!FSharpSet__Contains(visited, key)) {
|
|
537
|
-
return defaultArg((option_3 = symbol_1.declarations, (option_3 != null) ? exists((declaration) => {
|
|
538
|
-
if (declaration.kind === 266) {
|
|
539
|
-
return standsForConditional(checker, FSharpSet__Add(visited, key), declaration.type);
|
|
540
|
-
}
|
|
541
|
-
else {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
}, option_3) : undefined), false);
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
return false;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
case 195:
|
|
552
|
-
return true;
|
|
553
|
-
case 197: {
|
|
554
|
-
checker_mut = checker;
|
|
555
|
-
visited_mut = visited;
|
|
556
|
-
node_mut = node.type;
|
|
557
|
-
continue standsForConditional;
|
|
558
|
-
}
|
|
559
|
-
default:
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
function isWithinConstraint(node_mut) {
|
|
567
|
-
isWithinConstraint:
|
|
568
|
-
while (true) {
|
|
569
|
-
const node = node_mut;
|
|
570
|
-
if (Operators_IsNull(node) ? true : Operators_IsNull(node.parent)) {
|
|
571
|
-
return false;
|
|
572
|
-
}
|
|
573
|
-
else if (node.parent.kind === 169) {
|
|
574
|
-
const matchValue = node.parent.constraint;
|
|
575
|
-
if (matchValue == null) {
|
|
576
|
-
return false;
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
return matchValue === node;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
node_mut = node.parent;
|
|
584
|
-
continue isWithinConstraint;
|
|
585
|
-
}
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
function tryResolveDeferred(reader, typeNode) {
|
|
591
|
-
let resolvedNode, previousContext;
|
|
592
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
593
|
-
const bindings = boundTypeParameters(reader, typeNode);
|
|
594
|
-
if (((!isParseTreeNode(typeNode) ? true : !standsForConditional(checker, empty_2({
|
|
595
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
596
|
-
}), typeNode)) ? true : isWithinConstraint(typeNode)) ? true : !mentionsBoundTypeParameter(bindings, typeNode)) {
|
|
597
|
-
return undefined;
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
const typ = checker.getTypeAtLocation(typeNode);
|
|
601
|
-
if (isEmpty(deferredConditionals(checker, 0, typ))) {
|
|
602
|
-
return undefined;
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
let option_3;
|
|
606
|
-
const option_1 = resolveWithBindings(checker, typeNode, bindings, empty_1({
|
|
607
|
-
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
608
|
-
}), typ);
|
|
609
|
-
if (option_1 != null) {
|
|
610
|
-
const resolved = option_1;
|
|
611
|
-
option_3 = checker.typeToTypeNode(resolved, enclosingDeclarationOf(typeNode), typeNodeBuilderFlags);
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
option_3 = undefined;
|
|
615
|
-
}
|
|
616
|
-
if (option_3 != null) {
|
|
617
|
-
return (resolvedNode = option_3, (previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"](), (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](typeNode), (() => {
|
|
618
|
-
try {
|
|
619
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](resolvedNode);
|
|
620
|
-
}
|
|
621
|
-
finally {
|
|
622
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
623
|
-
}
|
|
624
|
-
})())));
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
return undefined;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
function inferTypeNodes(node) {
|
|
634
|
-
return toList(delay(() => append_1((node.kind === 196) ? singleton_1(node) : empty_3(), delay(() => collect_2(inferTypeNodes, node.getChildren())))));
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function inferredConstraint(reader, inferTypeNode) {
|
|
638
|
-
const matchValue_1 = inferTypeNode.typeParameter.constraint;
|
|
639
|
-
if (matchValue_1 == null) {
|
|
640
|
-
let atPosition;
|
|
641
|
-
if (inferTypeNode.parent.kind === 184) {
|
|
642
|
-
const typeReferenceNode = inferTypeNode.parent;
|
|
643
|
-
let position;
|
|
644
|
-
const option_1 = typeReferenceNode.typeArguments;
|
|
645
|
-
position = ((option_1 != null) ? tryFindIndex((typeArgument) => (typeArgument === inferTypeNode), option_1) : undefined);
|
|
646
|
-
let option_13;
|
|
647
|
-
let option_9;
|
|
648
|
-
let option_7;
|
|
649
|
-
let option_5;
|
|
650
|
-
const option_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
|
|
651
|
-
let binder_2;
|
|
652
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
653
|
-
binder_2 = ((symbol) => resolveAlias(checker, symbol));
|
|
654
|
-
const option_3 = option_2;
|
|
655
|
-
option_5 = ((option_3 != null) ? binder_2(option_3) : undefined);
|
|
656
|
-
if (option_5 != null) {
|
|
657
|
-
const symbol_1 = option_5;
|
|
658
|
-
option_7 = symbol_1.declarations;
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
option_7 = undefined;
|
|
662
|
-
}
|
|
663
|
-
option_9 = ((option_7 != null) ? tryHead(option_7) : undefined);
|
|
664
|
-
if (option_9 != null) {
|
|
665
|
-
const declaration = option_9;
|
|
666
|
-
const matchValue = declaration.kind;
|
|
667
|
-
option_13 = ((matchValue === 264) ? declaration.typeParameters : ((matchValue === 265) ? declaration.typeParameters : ((matchValue === 266) ? declaration.typeParameters : undefined)));
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
option_13 = undefined;
|
|
671
|
-
}
|
|
672
|
-
if (option_13 != null) {
|
|
673
|
-
const typeParameters = option_13;
|
|
674
|
-
const option_11 = position;
|
|
675
|
-
if (option_11 != null) {
|
|
676
|
-
const position_1 = option_11 | 0;
|
|
677
|
-
atPosition = ((position_1 < ~~typeParameters.length) ? (typeParameters[position_1]).constraint : undefined);
|
|
678
|
-
}
|
|
679
|
-
else {
|
|
680
|
-
atPosition = undefined;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
atPosition = undefined;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
atPosition = undefined;
|
|
689
|
-
}
|
|
690
|
-
if (atPosition == null) {
|
|
691
|
-
return GlueType.Unknown;
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
const constraintNode_1 = atPosition;
|
|
695
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode_1);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
const constraintNode = matchValue_1;
|
|
700
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function truncateToDeclaredArity(reader, symbolOpt, typeArguments) {
|
|
705
|
-
let option_5, _arg;
|
|
706
|
-
let declaredArity;
|
|
707
|
-
let option_8;
|
|
708
|
-
let option_2;
|
|
709
|
-
let binder;
|
|
710
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
711
|
-
binder = ((symbol) => resolveAlias(checker, symbol));
|
|
712
|
-
const option_1 = symbolOpt;
|
|
713
|
-
option_2 = ((option_1 != null) ? binder(option_1) : undefined);
|
|
714
|
-
let binder_2;
|
|
715
|
-
const packageContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
716
|
-
binder_2 = ((symbol_1) => mainDeclaration(packageContext, symbol_1));
|
|
717
|
-
const option_3 = option_2;
|
|
718
|
-
option_8 = ((option_3 != null) ? binder_2(option_3) : undefined);
|
|
719
|
-
if (option_8 != null) {
|
|
720
|
-
const declaration = option_8;
|
|
721
|
-
const matchValue = declaration.kind;
|
|
722
|
-
switch (matchValue) {
|
|
723
|
-
case 264:
|
|
724
|
-
case 265:
|
|
725
|
-
case 266: {
|
|
726
|
-
declaredArity = defaultArg((option_5 = declaration.typeParameters, (option_5 != null) ? ((_arg = option_5, ~~_arg.length)) : undefined), 0);
|
|
727
|
-
break;
|
|
728
|
-
}
|
|
729
|
-
default:
|
|
730
|
-
declaredArity = undefined;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
else {
|
|
734
|
-
declaredArity = undefined;
|
|
735
|
-
}
|
|
736
|
-
let matchResult, arity_1;
|
|
737
|
-
if (declaredArity != null) {
|
|
738
|
-
if (declaredArity < length(typeArguments)) {
|
|
739
|
-
matchResult = 0;
|
|
740
|
-
arity_1 = declaredArity;
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
matchResult = 1;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
else {
|
|
747
|
-
matchResult = 1;
|
|
748
|
-
}
|
|
749
|
-
switch (matchResult) {
|
|
750
|
-
case 0:
|
|
751
|
-
return truncate(arity_1, typeArguments);
|
|
752
|
-
default:
|
|
753
|
-
return typeArguments;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function isGlobalThisQuery(typeNode) {
|
|
758
|
-
if (typeNode.kind === 187) {
|
|
759
|
-
return entityNameText(typeNode.exprName) === "globalThis";
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
return false;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
function readTypeUsingFlags(reader, typ) {
|
|
767
|
-
let declarations;
|
|
768
|
-
const matchValue = typ.flags;
|
|
769
|
-
let matchResult;
|
|
770
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
|
|
771
|
-
if (Operators_IsNull(typ.symbol)) {
|
|
772
|
-
matchResult = 0;
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
matchResult = 1;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
else {
|
|
779
|
-
matchResult = 1;
|
|
780
|
-
}
|
|
781
|
-
switch (matchResult) {
|
|
782
|
-
case 0:
|
|
783
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
784
|
-
default:
|
|
785
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
|
|
786
|
-
const matchValue_1 = typ.symbol.declarations;
|
|
787
|
-
let matchResult_1, declarations_1;
|
|
788
|
-
if (matchValue_1 != null) {
|
|
789
|
-
if ((declarations = matchValue_1, declarations.length > 0)) {
|
|
790
|
-
matchResult_1 = 0;
|
|
791
|
-
declarations_1 = matchValue_1;
|
|
792
|
-
}
|
|
793
|
-
else {
|
|
794
|
-
matchResult_1 = 1;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
else {
|
|
798
|
-
matchResult_1 = 1;
|
|
799
|
-
}
|
|
800
|
-
switch (matchResult_1) {
|
|
801
|
-
case 0: {
|
|
802
|
-
const declaration = item_4(0, declarations_1);
|
|
803
|
-
const matchValue_2 = declaration.kind;
|
|
804
|
-
switch (matchValue_2) {
|
|
805
|
-
case 264:
|
|
806
|
-
return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(empty(), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getFullyQualifiedName(typ.symbol), typ.symbol.name, empty(), empty(), empty(), empty(), true)]);
|
|
807
|
-
case 265:
|
|
808
|
-
case 266: {
|
|
809
|
-
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
|
|
810
|
-
if (matchValue_3 == null) {
|
|
811
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration);
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
const typeNode = matchValue_3;
|
|
815
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
case 268:
|
|
819
|
-
return GlueType.Discard;
|
|
820
|
-
default:
|
|
821
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
default:
|
|
825
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
return primitiveOfFlags(typ);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
export function UtilityType_readExclude(reader, typeReferenceNode) {
|
|
835
|
-
let matchValue_1, activePatternResult_4, item, objectArg, activePatternResult_6, item_1, objectArg_1, matchValue_3, typeArguments, typeArguments_1, excluded, isNullish, matchValue_5, symbol, matchValue_6, matchValue_7, typeArguments_2, typeArguments_3, excluded_1, isNullish_1, matchValue_9, symbol_1, matchValue_10, matchValue_11, typeArguments_4, typeArguments_5, excluded_2, isNullish_2, matchValue_13, symbol_2, matchValue_14;
|
|
836
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
|
|
837
|
-
const matchValue = typ.flags;
|
|
838
|
-
let matchResult;
|
|
839
|
-
if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
|
|
840
|
-
matchResult = 0;
|
|
841
|
-
}
|
|
842
|
-
else if ($007CHasTypeFlags$007C_$007C(2048, matchValue) != null) {
|
|
843
|
-
matchResult = 0;
|
|
844
|
-
}
|
|
845
|
-
else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
|
|
846
|
-
matchResult = 0;
|
|
847
|
-
}
|
|
848
|
-
else {
|
|
849
|
-
matchResult = 1;
|
|
850
|
-
}
|
|
851
|
-
switch (matchResult) {
|
|
852
|
-
case 0:
|
|
853
|
-
return new GlueType(/* Union */ 7, [new GlueTypeUnion((matchValue_1 = typ.flags, ($007CHasTypeFlags$007C_$007C(1024, matchValue_1) != null) ? ((activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ), (activePatternResult_4.tag === 1) ? (((item = Report_readerError_Z19516DCE("Exclude", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 696), (objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg.push(item)))), empty())) : singleton(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_4.fields[0]])])))) : (($007CHasTypeFlags$007C_$007C(2048, matchValue_1) != null) ? ((activePatternResult_6 = Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(typ), (activePatternResult_6.tag === 1) ? singleton(new GlueType(/* Literal */ 8, [new GlueLiteral(/* Float */ 2, [activePatternResult_6.fields[0]])])) : ((activePatternResult_6.tag === 2) ? (((item_1 = Report_readerError_Z19516DCE("Exclude", "Expected a number literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 711), (objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_1.push(item_1)))), empty())) : singleton(new GlueType(/* Literal */ 8, [new GlueLiteral(/* Int */ 1, [activePatternResult_6.fields[0]])]))))) : choose((typ_1) => {
|
|
854
|
-
const matchValue_2 = typ_1.flags;
|
|
855
|
-
if ($007CHasTypeFlags$007C_$007C(1024, matchValue_2) != null) {
|
|
856
|
-
const literalType = typ_1;
|
|
857
|
-
return new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [literalType.value])]);
|
|
858
|
-
}
|
|
859
|
-
else if ($007CHasTypeFlags$007C_$007C(2048, matchValue_2) != null) {
|
|
860
|
-
const activePatternResult_9 = Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(typ_1);
|
|
861
|
-
switch (activePatternResult_9.tag) {
|
|
862
|
-
case 1:
|
|
863
|
-
return new GlueType(/* Literal */ 8, [new GlueLiteral(/* Float */ 2, [activePatternResult_9.fields[0]])]);
|
|
864
|
-
case 2: {
|
|
865
|
-
const item_2 = Report_readerError_Z19516DCE("Exclude", "Expected a number literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 738);
|
|
866
|
-
const objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
867
|
-
void (objectArg_2.push(item_2));
|
|
868
|
-
return undefined;
|
|
869
|
-
}
|
|
870
|
-
default:
|
|
871
|
-
return new GlueType(/* Literal */ 8, [new GlueLiteral(/* Int */ 1, [activePatternResult_9.fields[0]])]);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
else {
|
|
875
|
-
return undefined;
|
|
876
|
-
}
|
|
877
|
-
}, toList(typ.types)))))]);
|
|
878
|
-
default: {
|
|
879
|
-
let matchResult_1;
|
|
880
|
-
if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
881
|
-
if ((matchValue_3 = typeReferenceNode.typeArguments, (matchValue_3 != null) && (((typeArguments = matchValue_3, ~~typeArguments.length > 1)) && ((typeArguments_1 = matchValue_3, (excluded = (typeArguments_1[0]), (isNullish = ((typeNode) => {
|
|
882
|
-
const matchValue_4 = typeNode.kind;
|
|
883
|
-
switch (matchValue_4) {
|
|
884
|
-
case 157:
|
|
885
|
-
return true;
|
|
886
|
-
case 193:
|
|
887
|
-
return forAll(isNullish, typeNode.types);
|
|
888
|
-
case 202:
|
|
889
|
-
return typeNode.literal.kind === 106;
|
|
890
|
-
default:
|
|
891
|
-
return false;
|
|
892
|
-
}
|
|
893
|
-
}), (isNullish(typeArguments_1[1]) ? true : (excluded.kind === 200)) ? true : ((excluded.kind === 184) && ((matchValue_5 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded.typeName), (matchValue_5 == null) ? false : ((symbol = matchValue_5, (matchValue_6 = symbol.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_6) != null))))))))))))) {
|
|
894
|
-
matchResult_1 = 0;
|
|
895
|
-
}
|
|
896
|
-
else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
897
|
-
if ((matchValue_7 = typeReferenceNode.typeArguments, (matchValue_7 != null) && (((typeArguments_2 = matchValue_7, ~~typeArguments_2.length > 1)) && ((typeArguments_3 = matchValue_7, (excluded_1 = (typeArguments_3[0]), (isNullish_1 = ((typeNode_1) => {
|
|
898
|
-
const matchValue_8 = typeNode_1.kind;
|
|
899
|
-
switch (matchValue_8) {
|
|
900
|
-
case 157:
|
|
901
|
-
return true;
|
|
902
|
-
case 193:
|
|
903
|
-
return forAll(isNullish_1, typeNode_1.types);
|
|
904
|
-
case 202:
|
|
905
|
-
return typeNode_1.literal.kind === 106;
|
|
906
|
-
default:
|
|
907
|
-
return false;
|
|
908
|
-
}
|
|
909
|
-
}), (isNullish_1(typeArguments_3[1]) ? true : (excluded_1.kind === 200)) ? true : ((excluded_1.kind === 184) && ((matchValue_9 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded_1.typeName), (matchValue_9 == null) ? false : ((symbol_1 = matchValue_9, (matchValue_10 = symbol_1.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_10) != null))))))))))))) {
|
|
910
|
-
matchResult_1 = 0;
|
|
911
|
-
}
|
|
912
|
-
else {
|
|
913
|
-
matchResult_1 = 1;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
else {
|
|
917
|
-
matchResult_1 = 1;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
921
|
-
if ((matchValue_11 = typeReferenceNode.typeArguments, (matchValue_11 != null) && (((typeArguments_4 = matchValue_11, ~~typeArguments_4.length > 1)) && ((typeArguments_5 = matchValue_11, (excluded_2 = (typeArguments_5[0]), (isNullish_2 = ((typeNode_2) => {
|
|
922
|
-
const matchValue_12 = typeNode_2.kind;
|
|
923
|
-
switch (matchValue_12) {
|
|
924
|
-
case 157:
|
|
925
|
-
return true;
|
|
926
|
-
case 193:
|
|
927
|
-
return forAll(isNullish_2, typeNode_2.types);
|
|
928
|
-
case 202:
|
|
929
|
-
return typeNode_2.literal.kind === 106;
|
|
930
|
-
default:
|
|
931
|
-
return false;
|
|
932
|
-
}
|
|
933
|
-
}), (isNullish_2(typeArguments_5[1]) ? true : (excluded_2.kind === 200)) ? true : ((excluded_2.kind === 184) && ((matchValue_13 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded_2.typeName), (matchValue_13 == null) ? false : ((symbol_2 = matchValue_13, (matchValue_14 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_14) != null))))))))))))) {
|
|
934
|
-
matchResult_1 = 0;
|
|
935
|
-
}
|
|
936
|
-
else {
|
|
937
|
-
matchResult_1 = 1;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
matchResult_1 = 1;
|
|
942
|
-
}
|
|
943
|
-
switch (matchResult_1) {
|
|
944
|
-
case 0:
|
|
945
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_6(typeReferenceNode.typeArguments)[0]);
|
|
946
|
-
default:
|
|
947
|
-
if ($007CHasTypeFlags$007C_$007C(32, matchValue) != null) {
|
|
948
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
|
|
949
|
-
}
|
|
950
|
-
else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
|
|
951
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
|
|
952
|
-
}
|
|
953
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
|
|
954
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
|
|
955
|
-
}
|
|
956
|
-
else if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
957
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
958
|
-
}
|
|
959
|
-
else {
|
|
960
|
-
const item_3 = Report_readerError_Z19516DCE("Exclude", "Was expecting the resolved type to be a literal or a union", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 794);
|
|
961
|
-
const objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
962
|
-
void (objectArg_3.push(item_3));
|
|
963
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
function UtilityType_isMemberDeclaration(declaration) {
|
|
971
|
-
const matchValue = declaration.kind;
|
|
972
|
-
switch (matchValue) {
|
|
973
|
-
case 264:
|
|
974
|
-
case 265:
|
|
975
|
-
case 266:
|
|
976
|
-
case 267:
|
|
977
|
-
case 268:
|
|
978
|
-
return false;
|
|
979
|
-
default:
|
|
980
|
-
return true;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
function UtilityType_readPropertyMembers(reader, contextNode, property) {
|
|
985
|
-
let option_1;
|
|
986
|
-
const declarations = defaultArg((option_1 = property.declarations, (option_1 != null) ? toList(filter(UtilityType_isMemberDeclaration, option_1)) : undefined), empty());
|
|
987
|
-
return withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing, contextNode, () => (isEmpty(declarations) ? ofArray(toArray(readPropertyWithoutDeclaration(reader, contextNode, property))) : map_1((declaration_1) => readInstantiatedMember(reader, contextNode, property, declaration_1), declarations)));
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
function UtilityType_readMembers(reader, contextNode, typ) {
|
|
991
|
-
let objectArg;
|
|
992
|
-
return List_distinct(collect_1((property) => UtilityType_readPropertyMembers(reader, contextNode, property), toList((objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg.getPropertiesOfType(typ)))), {
|
|
993
|
-
Equals: equals,
|
|
994
|
-
GetHashCode: (x) => (safeHash(x) | 0),
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
/**
|
|
999
|
-
* When a generic type reference is applied with concrete type arguments
|
|
1000
|
-
* (e.g. a custom utility type like <c>Picked<User, "id"></c>), the
|
|
1001
|
-
* TypeChecker resolves it to an anonymous object type. We read its resolved
|
|
1002
|
-
* members (via <see cref="readMembers"/>) and expand it into a TypeLiteral
|
|
1003
|
-
* so it is generated as a concrete interface instead of an unusable
|
|
1004
|
-
* reference to the (generic) utility.
|
|
1005
|
-
*/
|
|
1006
|
-
export function UtilityType_tryExpandAnonymousObjectApplication(reader, typeReferenceNode) {
|
|
1007
|
-
let matchValue, typeArguments, typNode;
|
|
1008
|
-
if (!((matchValue = typeReferenceNode.typeArguments, (matchValue == null) ? false : ((typeArguments = matchValue, ~~typeArguments.length > 0))))) {
|
|
1009
|
-
return undefined;
|
|
1010
|
-
}
|
|
1011
|
-
else {
|
|
1012
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
|
|
1013
|
-
let isNamedDeclaration;
|
|
1014
|
-
if (Operators_IsNull(typ.symbol)) {
|
|
1015
|
-
isNamedDeclaration = false;
|
|
1016
|
-
}
|
|
1017
|
-
else {
|
|
1018
|
-
const matchValue_1 = typ.symbol.declarations;
|
|
1019
|
-
isNamedDeclaration = ((matchValue_1 == null) ? false : exists((declaration) => {
|
|
1020
|
-
const matchValue_2 = declaration.kind;
|
|
1021
|
-
switch (matchValue_2) {
|
|
1022
|
-
case 264:
|
|
1023
|
-
case 265:
|
|
1024
|
-
return true;
|
|
1025
|
-
default:
|
|
1026
|
-
return false;
|
|
1027
|
-
}
|
|
1028
|
-
}, matchValue_1));
|
|
1029
|
-
}
|
|
1030
|
-
let isTypeAliasApplication;
|
|
1031
|
-
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
|
|
1032
|
-
if (matchValue_3 == null) {
|
|
1033
|
-
isTypeAliasApplication = false;
|
|
1034
|
-
}
|
|
1035
|
-
else {
|
|
1036
|
-
const symbol = matchValue_3;
|
|
1037
|
-
const matchValue_4 = symbol.flags;
|
|
1038
|
-
isTypeAliasApplication = ($007CHasSymbolFlags$007C_$007C(524288, matchValue_4) != null);
|
|
1039
|
-
}
|
|
1040
|
-
const isInProgress = exists((inProgress) => (inProgress === typ), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions);
|
|
1041
|
-
let isGenericMapped;
|
|
1042
|
-
const matchValue_5 = typ.flags;
|
|
1043
|
-
isGenericMapped = (($007CHasTypeFlags$007C_$007C(1048576, matchValue_5) != null) && (((typ.objectFlags & 32) !== 0) && exists((argument) => {
|
|
1044
|
-
const matchValue_6 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(argument).flags;
|
|
1045
|
-
if ($007CHasTypeFlags$007C_$007C(524288, matchValue_6) != null) {
|
|
1046
|
-
return true;
|
|
1047
|
-
}
|
|
1048
|
-
else {
|
|
1049
|
-
return false;
|
|
1050
|
-
}
|
|
1051
|
-
}, value_6(typeReferenceNode.typeArguments))));
|
|
1052
|
-
const isArrayLike = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().isArrayLikeType(typ);
|
|
1053
|
-
const matchValue_7 = typ.flags;
|
|
1054
|
-
let matchResult;
|
|
1055
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_7) != null) {
|
|
1056
|
-
if ((isTupleType(typ) ? true : (isArrayLike && !isNamedDeclaration)) && !isInProgress) {
|
|
1057
|
-
matchResult = 0;
|
|
1058
|
-
}
|
|
1059
|
-
else {
|
|
1060
|
-
matchResult = 1;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
matchResult = 1;
|
|
1065
|
-
}
|
|
1066
|
-
switch (matchResult) {
|
|
1067
|
-
case 0: {
|
|
1068
|
-
const option_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
|
|
1069
|
-
if (option_1 != null) {
|
|
1070
|
-
return (typNode = option_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode));
|
|
1071
|
-
}
|
|
1072
|
-
else {
|
|
1073
|
-
return undefined;
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
default: {
|
|
1077
|
-
let matchResult_1;
|
|
1078
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_7) != null) {
|
|
1079
|
-
if ((!isNamedDeclaration && !isInProgress) && !isGenericMapped) {
|
|
1080
|
-
matchResult_1 = 0;
|
|
1081
|
-
}
|
|
1082
|
-
else {
|
|
1083
|
-
matchResult_1 = 1;
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
else {
|
|
1087
|
-
matchResult_1 = 1;
|
|
1088
|
-
}
|
|
1089
|
-
switch (matchResult_1) {
|
|
1090
|
-
case 0: {
|
|
1091
|
-
const members = withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions, typ, () => UtilityType_readMembers(reader, typeReferenceNode, typ));
|
|
1092
|
-
if (isEmpty(members)) {
|
|
1093
|
-
return undefined;
|
|
1094
|
-
}
|
|
1095
|
-
else {
|
|
1096
|
-
return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(members, undefined)]);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
default: {
|
|
1100
|
-
let matchResult_2;
|
|
1101
|
-
if ($007CHasTypeFlags$007C_$007C(32, matchValue_7) != null) {
|
|
1102
|
-
if (isTypeAliasApplication) {
|
|
1103
|
-
matchResult_2 = 0;
|
|
1104
|
-
}
|
|
1105
|
-
else if ($007CHasTypeFlags$007C_$007C(64, matchValue_7) != null) {
|
|
1106
|
-
if (isTypeAliasApplication) {
|
|
1107
|
-
matchResult_2 = 0;
|
|
1108
|
-
}
|
|
1109
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue_7) != null) {
|
|
1110
|
-
if (isTypeAliasApplication) {
|
|
1111
|
-
matchResult_2 = 0;
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
matchResult_2 = 1;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
else {
|
|
1118
|
-
matchResult_2 = 1;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue_7) != null) {
|
|
1122
|
-
if (isTypeAliasApplication) {
|
|
1123
|
-
matchResult_2 = 0;
|
|
1124
|
-
}
|
|
1125
|
-
else {
|
|
1126
|
-
matchResult_2 = 1;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
else {
|
|
1130
|
-
matchResult_2 = 1;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
else if ($007CHasTypeFlags$007C_$007C(64, matchValue_7) != null) {
|
|
1134
|
-
if (isTypeAliasApplication) {
|
|
1135
|
-
matchResult_2 = 0;
|
|
1136
|
-
}
|
|
1137
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue_7) != null) {
|
|
1138
|
-
if (isTypeAliasApplication) {
|
|
1139
|
-
matchResult_2 = 0;
|
|
1140
|
-
}
|
|
1141
|
-
else {
|
|
1142
|
-
matchResult_2 = 1;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
else {
|
|
1146
|
-
matchResult_2 = 1;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue_7) != null) {
|
|
1150
|
-
if (isTypeAliasApplication) {
|
|
1151
|
-
matchResult_2 = 0;
|
|
1152
|
-
}
|
|
1153
|
-
else {
|
|
1154
|
-
matchResult_2 = 1;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
else {
|
|
1158
|
-
matchResult_2 = 1;
|
|
1159
|
-
}
|
|
1160
|
-
switch (matchResult_2) {
|
|
1161
|
-
case 0:
|
|
1162
|
-
return readTypeUsingFlags(reader, typ);
|
|
1163
|
-
default:
|
|
1164
|
-
return undefined;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
function UtilityType_baseTypeOf(reader, typeNode) {
|
|
1174
|
-
let option_2, option, binder, checker, option_1, mapping, objectArg, option_3;
|
|
1175
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeNode);
|
|
1176
|
-
const matchValue = typ.flags;
|
|
1177
|
-
let matchResult;
|
|
1178
|
-
if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
1179
|
-
if ((typeNode.pos < 0) && (typeNode.kind === 184)) {
|
|
1180
|
-
matchResult = 0;
|
|
1181
|
-
}
|
|
1182
|
-
else {
|
|
1183
|
-
matchResult = 1;
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
else {
|
|
1187
|
-
matchResult = 1;
|
|
1188
|
-
}
|
|
1189
|
-
switch (matchResult) {
|
|
1190
|
-
case 0:
|
|
1191
|
-
return defaultArg((option_2 = ((option = symbolAtLocation(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), typeNode.typeName), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (mapping = ((objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol_1) => objectArg.getDeclaredTypeOfSymbol(symbol_1))), (option_3 = option_2, (option_3 != null) ? mapping(option_3) : undefined))), typ);
|
|
1192
|
-
default:
|
|
1193
|
-
return typ;
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
function UtilityType_literalKeysOf(typeNode_mut) {
|
|
1198
|
-
UtilityType_literalKeysOf:
|
|
1199
|
-
while (true) {
|
|
1200
|
-
const typeNode = typeNode_mut;
|
|
1201
|
-
const matchValue = typeNode.kind;
|
|
1202
|
-
switch (matchValue) {
|
|
1203
|
-
case 193:
|
|
1204
|
-
return collect_1(UtilityType_literalKeysOf, toList(typeNode.types));
|
|
1205
|
-
case 197: {
|
|
1206
|
-
typeNode_mut = typeNode.type;
|
|
1207
|
-
continue UtilityType_literalKeysOf;
|
|
1208
|
-
}
|
|
1209
|
-
case 202: {
|
|
1210
|
-
const literal = typeNode.literal;
|
|
1211
|
-
if (literal.kind === 11) {
|
|
1212
|
-
return singleton(literal.text);
|
|
1213
|
-
}
|
|
1214
|
-
else {
|
|
1215
|
-
return empty();
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
default:
|
|
1219
|
-
return empty();
|
|
1220
|
-
}
|
|
1221
|
-
break;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
function UtilityType_withoutForeignTypeParameters(reader, bound, members) {
|
|
1226
|
-
const declaredAbove = (node) => {
|
|
1227
|
-
if (Operators_IsNull(node)) {
|
|
1228
|
-
return empty();
|
|
1229
|
-
}
|
|
1230
|
-
else {
|
|
1231
|
-
const typeParameters = node.typeParameters;
|
|
1232
|
-
return append((typeParameters == null) ? empty() : map_1((p) => identifierText(p.name), toList(typeParameters)), declaredAbove(node.parent));
|
|
1233
|
-
}
|
|
1234
|
-
};
|
|
1235
|
-
let inScope;
|
|
1236
|
-
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
1237
|
-
inScope = ((matchValue == null) ? empty() : declaredAbove(matchValue));
|
|
1238
|
-
const signatureMentions = (returnType, parameters) => append(GlueSubstitution_mentionedTypeParameters(returnType), collect_1((parameter) => GlueSubstitution_mentionedTypeParameters(parameter.Type), parameters));
|
|
1239
|
-
const foreign = ofList(map_1((name_1) => [name_1, new GlueType(/* Primitive */ 3, [GluePrimitive.Any])], filter_1((name) => {
|
|
1240
|
-
if (!contains(name, inScope, {
|
|
1241
|
-
Equals: (x_1, y_1) => (x_1 === y_1),
|
|
1242
|
-
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
1243
|
-
})) {
|
|
1244
|
-
return !FSharpMap__ContainsKey(bound, name);
|
|
1245
|
-
}
|
|
1246
|
-
else {
|
|
1247
|
-
return false;
|
|
1248
|
-
}
|
|
1249
|
-
}, List_distinct(collect_1((glueMember) => {
|
|
1250
|
-
switch (glueMember.tag) {
|
|
1251
|
-
case 1:
|
|
1252
|
-
return GlueSubstitution_mentionedTypeParameters(glueMember.fields[0].Type);
|
|
1253
|
-
case 0: {
|
|
1254
|
-
const method = glueMember.fields[0];
|
|
1255
|
-
return signatureMentions(method.Type, method.Parameters);
|
|
1256
|
-
}
|
|
1257
|
-
case 6: {
|
|
1258
|
-
const method_1 = glueMember.fields[0];
|
|
1259
|
-
return signatureMentions(method_1.Type, method_1.Parameters);
|
|
1260
|
-
}
|
|
1261
|
-
default:
|
|
1262
|
-
return empty();
|
|
1263
|
-
}
|
|
1264
|
-
}, members), {
|
|
1265
|
-
Equals: (x, y) => (x === y),
|
|
1266
|
-
GetHashCode: (x) => (stringHash(x) | 0),
|
|
1267
|
-
}))), {
|
|
1268
|
-
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
1269
|
-
});
|
|
1270
|
-
if (FSharpMap__get_IsEmpty(foreign)) {
|
|
1271
|
-
return members;
|
|
1272
|
-
}
|
|
1273
|
-
else {
|
|
1274
|
-
return map_1((glueMember_1) => GlueSubstitution_substituteMember(foreign, glueMember_1), members);
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
export function UtilityType_readPartial(reader, typeReferenceNode) {
|
|
1279
|
-
const baseType = UtilityType_baseTypeOf(reader, value_6(typeReferenceNode.typeArguments)[0]);
|
|
1280
|
-
if (exists((typ) => (typ === baseType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Partials)) {
|
|
1281
|
-
const item = Report_readerError_Z19516DCE("Partial", "Recursive Partial is not supported, defaulting to obj", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1040);
|
|
1282
|
-
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
1283
|
-
void (objectArg.push(item));
|
|
1284
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
1285
|
-
}
|
|
1286
|
-
else {
|
|
1287
|
-
return withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Partials, baseType, () => {
|
|
1288
|
-
if (isTupleType(baseType)) {
|
|
1289
|
-
const typNode = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode), undefined, typeNodeBuilderFlags);
|
|
1290
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
|
|
1291
|
-
}
|
|
1292
|
-
else {
|
|
1293
|
-
const baseNode = value_6(typeReferenceNode.typeArguments)[0];
|
|
1294
|
-
let members;
|
|
1295
|
-
const matchValue = baseType.flags;
|
|
1296
|
-
let matchResult;
|
|
1297
|
-
if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
1298
|
-
if (baseNode.kind === 133) {
|
|
1299
|
-
matchResult = 0;
|
|
1300
|
-
}
|
|
1301
|
-
else {
|
|
1302
|
-
matchResult = 1;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
else {
|
|
1306
|
-
matchResult = 1;
|
|
1307
|
-
}
|
|
1308
|
-
switch (matchResult) {
|
|
1309
|
-
case 0: {
|
|
1310
|
-
members = empty();
|
|
1311
|
-
break;
|
|
1312
|
-
}
|
|
1313
|
-
default: {
|
|
1314
|
-
let matchResult_1;
|
|
1315
|
-
if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
1316
|
-
if ((baseNode.pos < 0) && (baseNode.kind === 188)) {
|
|
1317
|
-
matchResult_1 = 0;
|
|
1318
|
-
}
|
|
1319
|
-
else {
|
|
1320
|
-
matchResult_1 = 1;
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
else {
|
|
1324
|
-
matchResult_1 = 1;
|
|
1325
|
-
}
|
|
1326
|
-
switch (matchResult_1) {
|
|
1327
|
-
case 0: {
|
|
1328
|
-
const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](baseNode);
|
|
1329
|
-
members = ((matchValue_1.tag === 22) ? matchValue_1.fields[0].Members : empty());
|
|
1330
|
-
break;
|
|
1331
|
-
}
|
|
1332
|
-
default:
|
|
1333
|
-
if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
1334
|
-
const item_1 = Report_readerError_Z19516DCE("partial inner type", "Was not able to resolve the inner type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1082);
|
|
1335
|
-
const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
1336
|
-
void (objectArg_1.push(item_1));
|
|
1337
|
-
members = empty();
|
|
1338
|
-
}
|
|
1339
|
-
else {
|
|
1340
|
-
members = UtilityType_readMembers(reader, typeReferenceNode, baseType);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
const defaults = defaultTypeArguments(reader, value_6(typeReferenceNode.typeArguments)[0]);
|
|
1346
|
-
let members_2;
|
|
1347
|
-
const members_1 = map_1((glueMember) => GlueSubstitution_substituteMember(defaults, glueMember), members);
|
|
1348
|
-
members_2 = ((typeReferenceNode.pos < 0) ? UtilityType_withoutForeignTypeParameters(reader, defaults, members_1) : members_1);
|
|
1349
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Partial */ 0, [new GlueInterface(empty(), getFullNameOrEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), typeReferenceNode), entityNameText(typeReferenceNode.typeName), members_2, empty(), empty())])]);
|
|
1350
|
-
}
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
export function UtilityType_readRecord(reader, typeReferenceNode) {
|
|
1356
|
-
const typeArguments = readTypeArguments(reader, typeReferenceNode);
|
|
1357
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Record */ 1, [new GlueRecord(item_5(0, typeArguments), item_5(1, typeArguments))])]);
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
export function UtilityType_readReturnType(reader, typeReferenceNode) {
|
|
1361
|
-
let matchValue_4, matchValue_1, symbol, matchValue_2, declarations, declarations_1;
|
|
1362
|
-
const rawTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
|
|
1363
|
-
let typ;
|
|
1364
|
-
const matchValue = rawTyp.flags;
|
|
1365
|
-
let matchResult;
|
|
1366
|
-
if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
1367
|
-
matchResult = 0;
|
|
1368
|
-
}
|
|
1369
|
-
else if ($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) {
|
|
1370
|
-
matchResult = 0;
|
|
1371
|
-
}
|
|
1372
|
-
else if ($007CHasTypeFlags$007C_$007C(16777216, matchValue) != null) {
|
|
1373
|
-
matchResult = 0;
|
|
1374
|
-
}
|
|
1375
|
-
else if ($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) {
|
|
1376
|
-
matchResult = 0;
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
matchResult = 1;
|
|
1380
|
-
}
|
|
1381
|
-
switch (matchResult) {
|
|
1382
|
-
case 0: {
|
|
1383
|
-
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getApparentType(rawTyp);
|
|
1384
|
-
break;
|
|
1385
|
-
}
|
|
1386
|
-
default:
|
|
1387
|
-
typ = rawTyp;
|
|
1388
|
-
}
|
|
1389
|
-
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
|
|
1390
|
-
if (matchValue_3 == null) {
|
|
1391
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ReturnType */ 2, [readTypeUsingFlags(reader, typ)])]);
|
|
1392
|
-
}
|
|
1393
|
-
else {
|
|
1394
|
-
const typeNode = matchValue_3;
|
|
1395
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ReturnType */ 2, [(matchValue_4 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode), (matchValue_4.tag === 22) ? ((matchValue_4.fields[0].Id == null) ? (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(matchValue_4.fields[0].Members, (matchValue_1 = typ.getSymbol(), (matchValue_1 == null) ? undefined : ((symbol = matchValue_1, (matchValue_2 = symbol.declarations, (matchValue_2 != null) ? (((declarations = matchValue_2, declarations.length > 0)) ? ((declarations_1 = matchValue_2, typeLiteralId(item_4(0, declarations_1)))) : undefined) : undefined)))))])) : matchValue_4) : matchValue_4)])]);
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
export function UtilityType_readThisParameterType(reader, typeReferenceNode) {
|
|
1400
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
|
|
1401
|
-
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
|
|
1402
|
-
if (matchValue == null) {
|
|
1403
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ThisParameterType */ 3, [readTypeUsingFlags(reader, typ)])]);
|
|
1404
|
-
}
|
|
1405
|
-
else {
|
|
1406
|
-
const typeNode = matchValue;
|
|
1407
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ThisParameterType */ 3, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode)])]);
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
export function UtilityType_readOmitOrPick(reader, typeReferenceNode, keepListedKeys) {
|
|
1412
|
-
let option_1, matchValue_4, item_1, objectArg_2, objectArg_3;
|
|
1413
|
-
let keysToOmitType;
|
|
1414
|
-
const node = value_6(typeReferenceNode.typeArguments)[1];
|
|
1415
|
-
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
1416
|
-
keysToOmitType = objectArg.getTypeFromTypeNode(node);
|
|
1417
|
-
let hasUnboundKeys;
|
|
1418
|
-
const matchValue = keysToOmitType.flags;
|
|
1419
|
-
let matchResult;
|
|
1420
|
-
if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
|
|
1421
|
-
matchResult = 0;
|
|
1422
|
-
}
|
|
1423
|
-
else if ($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) {
|
|
1424
|
-
matchResult = 0;
|
|
1425
|
-
}
|
|
1426
|
-
else if ($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) {
|
|
1427
|
-
matchResult = 0;
|
|
1428
|
-
}
|
|
1429
|
-
else {
|
|
1430
|
-
matchResult = 1;
|
|
1431
|
-
}
|
|
1432
|
-
switch (matchResult) {
|
|
1433
|
-
case 0: {
|
|
1434
|
-
hasUnboundKeys = true;
|
|
1435
|
-
break;
|
|
1436
|
-
}
|
|
1437
|
-
default:
|
|
1438
|
-
hasUnboundKeys = false;
|
|
1439
|
-
}
|
|
1440
|
-
const tryReadValueOfKeys = (typ) => {
|
|
1441
|
-
const activePatternResult_3 = Type_StringLiteral_$007CString$007COther$007C(typ);
|
|
1442
|
-
if (activePatternResult_3.tag === 1) {
|
|
1443
|
-
const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1204);
|
|
1444
|
-
const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
1445
|
-
void (objectArg_1.push(item));
|
|
1446
|
-
return undefined;
|
|
1447
|
-
}
|
|
1448
|
-
else {
|
|
1449
|
-
return activePatternResult_3.fields[0];
|
|
1450
|
-
}
|
|
1451
|
-
};
|
|
1452
|
-
let keysToOmit;
|
|
1453
|
-
const matchValue_1 = keysToOmitType.flags;
|
|
1454
|
-
let matchResult_1;
|
|
1455
|
-
if (hasUnboundKeys) {
|
|
1456
|
-
matchResult_1 = 0;
|
|
1457
|
-
}
|
|
1458
|
-
else if ($007CHasTypeFlags$007C_$007C(1, matchValue_1) != null) {
|
|
1459
|
-
if (typeReferenceNode.pos < 0) {
|
|
1460
|
-
matchResult_1 = 1;
|
|
1461
|
-
}
|
|
1462
|
-
else {
|
|
1463
|
-
matchResult_1 = 2;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
else {
|
|
1467
|
-
matchResult_1 = 2;
|
|
1468
|
-
}
|
|
1469
|
-
switch (matchResult_1) {
|
|
1470
|
-
case 0: {
|
|
1471
|
-
keysToOmit = empty_3();
|
|
1472
|
-
break;
|
|
1473
|
-
}
|
|
1474
|
-
case 1: {
|
|
1475
|
-
keysToOmit = ofList_1(UtilityType_literalKeysOf(value_6(typeReferenceNode.typeArguments)[1]));
|
|
1476
|
-
break;
|
|
1477
|
-
}
|
|
1478
|
-
default:
|
|
1479
|
-
keysToOmit = (keysToOmitType.isUnion() ? choose_1(tryReadValueOfKeys, keysToOmitType.types) : defaultArg((option_1 = tryReadValueOfKeys(keysToOmitType), (option_1 != null) ? singleton_1(option_1) : undefined), []));
|
|
1480
|
-
}
|
|
1481
|
-
const baseType = UtilityType_baseTypeOf(reader, value_6(typeReferenceNode.typeArguments)[0]);
|
|
1482
|
-
let literalMembers;
|
|
1483
|
-
const matchValue_2 = baseType.flags;
|
|
1484
|
-
let matchResult_2;
|
|
1485
|
-
if ($007CHasTypeFlags$007C_$007C(1, matchValue_2) != null) {
|
|
1486
|
-
if (typeReferenceNode.pos < 0) {
|
|
1487
|
-
matchResult_2 = 0;
|
|
1488
|
-
}
|
|
1489
|
-
else {
|
|
1490
|
-
matchResult_2 = 1;
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
else {
|
|
1494
|
-
matchResult_2 = 1;
|
|
1495
|
-
}
|
|
1496
|
-
switch (matchResult_2) {
|
|
1497
|
-
case 0: {
|
|
1498
|
-
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_6(typeReferenceNode.typeArguments)[0]);
|
|
1499
|
-
literalMembers = ((matchValue_3.tag === 20) ? matchValue_3.fields[0] : ((matchValue_3.tag === 22) ? matchValue_3.fields[0].Members : undefined));
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
|
-
default:
|
|
1503
|
-
literalMembers = undefined;
|
|
1504
|
-
}
|
|
1505
|
-
const filteredProperties = toList(filter((prop) => (keepListedKeys === contains_1(prop.name, keysToOmit, {
|
|
1506
|
-
Equals: (x, y) => (x === y),
|
|
1507
|
-
GetHashCode: (x) => (stringHash(x) | 0),
|
|
1508
|
-
})), (matchValue_4 = baseType.flags, ($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? ((literalMembers != null) ? [] : (($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? (((item_1 = Report_readerError_Z19516DCE("omit base type", "Was not able to resolve the base type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1239), (objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_2.push(item_1)))), [])) : ((objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg_3.getPropertiesOfType(baseType))))) : (($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? (((item_1 = Report_readerError_Z19516DCE("omit base type", "Was not able to resolve the base type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1239), (objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_2.push(item_1)))), [])) : ((objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg_3.getPropertiesOfType(baseType)))))));
|
|
1509
|
-
const isInProgress = exists((inProgress) => (inProgress === baseType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions);
|
|
1510
|
-
const members_1 = isInProgress ? empty() : withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions, baseType, () => collect_1((property) => UtilityType_readPropertyMembers(reader, typeReferenceNode, property), filteredProperties));
|
|
1511
|
-
const defaults = defaultTypeArguments(reader, value_6(typeReferenceNode.typeArguments)[0]);
|
|
1512
|
-
let members_4;
|
|
1513
|
-
const members_3 = map_1((glueMember_2) => GlueSubstitution_substituteMember(defaults, glueMember_2), (literalMembers == null) ? members_1 : filter_1((glueMember_1) => {
|
|
1514
|
-
let matchValue_5;
|
|
1515
|
-
const glueMember = glueMember_1;
|
|
1516
|
-
switch (glueMember.tag) {
|
|
1517
|
-
case 0: {
|
|
1518
|
-
matchValue_5 = glueMember.fields[0].Name;
|
|
1519
|
-
break;
|
|
1520
|
-
}
|
|
1521
|
-
case 6: {
|
|
1522
|
-
matchValue_5 = glueMember.fields[0].Name;
|
|
1523
|
-
break;
|
|
1524
|
-
}
|
|
1525
|
-
case 2: {
|
|
1526
|
-
matchValue_5 = glueMember.fields[0].Name;
|
|
1527
|
-
break;
|
|
1528
|
-
}
|
|
1529
|
-
case 3: {
|
|
1530
|
-
matchValue_5 = glueMember.fields[0].Name;
|
|
1531
|
-
break;
|
|
1532
|
-
}
|
|
1533
|
-
case 4:
|
|
1534
|
-
case 5:
|
|
1535
|
-
case 7: {
|
|
1536
|
-
matchValue_5 = undefined;
|
|
1537
|
-
break;
|
|
1538
|
-
}
|
|
1539
|
-
default:
|
|
1540
|
-
matchValue_5 = glueMember.fields[0].Name;
|
|
1541
|
-
}
|
|
1542
|
-
if (matchValue_5 == null) {
|
|
1543
|
-
return !keepListedKeys;
|
|
1544
|
-
}
|
|
1545
|
-
else {
|
|
1546
|
-
return keepListedKeys === contains_1(matchValue_5, keysToOmit, {
|
|
1547
|
-
Equals: (x_1, y_2) => (x_1 === y_2),
|
|
1548
|
-
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
1549
|
-
});
|
|
1550
|
-
}
|
|
1551
|
-
}, literalMembers));
|
|
1552
|
-
members_4 = ((typeReferenceNode.pos < 0) ? UtilityType_withoutForeignTypeParameters(reader, defaults, members_3) : members_3);
|
|
1553
|
-
if (hasUnboundKeys ? true : isInProgress) {
|
|
1554
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
1555
|
-
}
|
|
1556
|
-
else {
|
|
1557
|
-
return new GlueType(/* UtilityType */ 27, [(keepListedKeys ? ((Item) => (new GlueUtilityType(/* Pick */ 5, [Item]))) : ((Item_1) => (new GlueUtilityType(/* Omit */ 4, [Item_1]))))(members_4)]);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
export function UtilityType_readOmit(reader, typeReferenceNode) {
|
|
1562
|
-
return UtilityType_readOmitOrPick(reader, typeReferenceNode, false);
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
export function UtilityType_readPick(reader, typeReferenceNode) {
|
|
1566
|
-
return UtilityType_readOmitOrPick(reader, typeReferenceNode, true);
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
export function UtilityType_readReadonly(reader, typeReferenceNode) {
|
|
1570
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
|
|
1571
|
-
const matchValue = typ.flags;
|
|
1572
|
-
let matchResult;
|
|
1573
|
-
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
|
|
1574
|
-
matchResult = 0;
|
|
1575
|
-
}
|
|
1576
|
-
else if ($007CHasTypeFlags$007C_$007C(268435456, matchValue) != null) {
|
|
1577
|
-
matchResult = 0;
|
|
1578
|
-
}
|
|
1579
|
-
else {
|
|
1580
|
-
matchResult = 1;
|
|
1581
|
-
}
|
|
1582
|
-
switch (matchResult) {
|
|
1583
|
-
case 0:
|
|
1584
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 6, [new GlueReadonly(/* Members */ 0, [UtilityType_readMembers(reader, typeReferenceNode, typ)])])]);
|
|
1585
|
-
default:
|
|
1586
|
-
if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
|
|
1587
|
-
const unionType = typ;
|
|
1588
|
-
try {
|
|
1589
|
-
return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 6, [new GlueReadonly(/* Union */ 1, [toList(choose_1((innerType) => {
|
|
1590
|
-
let copyOfStruct, Name;
|
|
1591
|
-
if ((copyOfStruct = innerType.flags, (copyOfStruct & 1048576) !== 0)) {
|
|
1592
|
-
return (Name = (value_6(innerType.aliasTypeArguments)[0]).symbol.name, new GlueInterface(empty(), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getFullyQualifiedName((value_6(innerType.aliasTypeArguments)[0]).symbol), Name, UtilityType_readMembers(reader, typeReferenceNode, innerType), empty(), empty()));
|
|
1593
|
-
}
|
|
1594
|
-
else {
|
|
1595
|
-
return undefined;
|
|
1596
|
-
}
|
|
1597
|
-
}, unionType.types))])])]);
|
|
1598
|
-
}
|
|
1599
|
-
catch (matchValue_1) {
|
|
1600
|
-
const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1363);
|
|
1601
|
-
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
1602
|
-
void (objectArg.push(item));
|
|
1603
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
else {
|
|
1607
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
2
|
+
import { tryReadLiteral, typeLiteralId, declaredName, isFromEsLib, Type_StringLiteral_$007CString$007COther$007C, isFromEs5Lib, entityNameText, readTypeArguments, landingOf, crossesNamespace, modulePathForSymbol, isLibraryName, getFullNameOrEmpty, knownExternalTypeNames, isExternalToPackages, importedName, identifierText, typeNodeBuilderFlags, $007CHasTypeFlags$007C_$007C, resolveAlias, $007CHasSymbolFlags$007C_$007C, symbolAtLocation } from "./Utils.js";
|
|
3
|
+
import { unwrap, orElse, defaultArg, value as value_2 } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
4
|
+
import { GlueTypeLiteral, GlueConstructSignature, GlueThisType, GlueFunctionType, GlueTypeUnion, GlueLiteral, GlueTypeReference, GluePrimitive, GlueType } from "../GlueAST.js";
|
|
5
|
+
import { readReadonly, readPick, readOmit, readThisParameterType, readReturnType, readRecord, readPartial, readExclude, tryExpandAnonymousObjectApplication } from "./UtilityType.js";
|
|
6
|
+
import { contains, item as item_1 } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
7
|
+
import { isGlobalThisQuery, truncateToDeclaredArity, tryResolveDeferred, isDeferredConditional } from "./Deferred.js";
|
|
8
|
+
import { filter, choose, sortByDescending, tryHead, map as map_1, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
9
|
+
import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
10
|
+
import { sanitizeTypeName } from "../Utils/Naming.js";
|
|
11
|
+
import { exists as exists_1, collect, head, tail, isEmpty, map, append, fold, singleton, empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
12
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
13
|
+
import { List_distinct, List_distinctBy } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
14
|
+
import { Exception, safeHash, equals, comparePrimitives, stringHash } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
15
|
+
import { ts } from "@ts-morph/bootstrap";
|
|
16
|
+
import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
17
|
+
import { readTypeQueryNode } from "./TypeQueryNode.js";
|
|
18
|
+
import { readIntersectionType } from "./IntersectionTypeNode.js";
|
|
19
|
+
import { readConditionalType } from "./ConditionalTypeNode.js";
|
|
20
|
+
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
21
|
+
import { readExpressionWithTypeArguments } from "./ExpressionWithTypeArguments.js";
|
|
22
|
+
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
1611
23
|
|
|
1612
24
|
function readTypeReference(reader, typeNode) {
|
|
1613
25
|
let option_13, symbol_4;
|
|
@@ -1617,12 +29,12 @@ function readTypeReference(reader, typeNode) {
|
|
|
1617
29
|
const readTypeReference_1 = (isStandardLibrary) => {
|
|
1618
30
|
let symbol_2, matchValue_3, declarations, typNode, option_9, valueDeclaration, matchValue_5, matchValue_6;
|
|
1619
31
|
if ((symbolOpt == null) ? false : ((symbol_2 = symbolOpt, (matchValue_3 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_3) != null)))) {
|
|
1620
|
-
return new GlueType(/* TypeParameter */ 16, [
|
|
32
|
+
return new GlueType(/* TypeParameter */ 16, [value_2(symbolOpt).name]);
|
|
1621
33
|
}
|
|
1622
34
|
else {
|
|
1623
35
|
let matchValue_4;
|
|
1624
36
|
let option_7;
|
|
1625
|
-
const option_5 =
|
|
37
|
+
const option_5 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
|
|
1626
38
|
if (option_5 != null) {
|
|
1627
39
|
option_7 = option_5;
|
|
1628
40
|
}
|
|
@@ -1652,7 +64,7 @@ function readTypeReference(reader, typeNode) {
|
|
|
1652
64
|
}
|
|
1653
65
|
switch (matchResult) {
|
|
1654
66
|
case 0: {
|
|
1655
|
-
const declaration =
|
|
67
|
+
const declaration = item_1(0, declarations_1);
|
|
1656
68
|
isConditionalAlias = ((declaration.kind === 266) && (declaration.type.kind === 195));
|
|
1657
69
|
break;
|
|
1658
70
|
}
|
|
@@ -1735,13 +147,13 @@ function readTypeReference(reader, typeNode) {
|
|
|
1735
147
|
}
|
|
1736
148
|
};
|
|
1737
149
|
if (((entityNameText(typeReferenceNode.typeName) === "NoInfer") && (typeReferenceNode.typeArguments != null)) && ((((option_13 = symbolOpt, (option_13 != null) ? ((symbol_4 = option_13, symbol_4.declarations)) : undefined)) == null) ? true : isFromEs5Lib(symbolOpt))) {
|
|
1738
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](
|
|
150
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_2(typeReferenceNode.typeArguments)[0]);
|
|
1739
151
|
}
|
|
1740
152
|
else if (isFromEs5Lib(symbolOpt)) {
|
|
1741
153
|
const matchValue_10 = getFullNameOrEmpty(checker, typeReferenceNode.typeName);
|
|
1742
154
|
switch (matchValue_10) {
|
|
1743
155
|
case "Exclude":
|
|
1744
|
-
return
|
|
156
|
+
return readExclude(reader, typeReferenceNode);
|
|
1745
157
|
case "Uppercase":
|
|
1746
158
|
case "Lowercase":
|
|
1747
159
|
case "Capitalize":
|
|
@@ -1779,7 +191,7 @@ function readTypeReference(reader, typeNode) {
|
|
|
1779
191
|
default:
|
|
1780
192
|
return undefined;
|
|
1781
193
|
}
|
|
1782
|
-
}, empty(),
|
|
194
|
+
}, empty(), map(literals, toList(typ_1.types)));
|
|
1783
195
|
}
|
|
1784
196
|
else {
|
|
1785
197
|
return undefined;
|
|
@@ -1820,33 +232,33 @@ function readTypeReference(reader, typeNode) {
|
|
|
1820
232
|
}
|
|
1821
233
|
}
|
|
1822
234
|
case "Partial":
|
|
1823
|
-
return
|
|
235
|
+
return readPartial(reader, typeReferenceNode);
|
|
1824
236
|
case "Record":
|
|
1825
|
-
return
|
|
237
|
+
return readRecord(reader, typeReferenceNode);
|
|
1826
238
|
case "ReturnType":
|
|
1827
|
-
return
|
|
239
|
+
return readReturnType(reader, typeReferenceNode);
|
|
1828
240
|
case "ThisParameterType":
|
|
1829
|
-
return
|
|
241
|
+
return readThisParameterType(reader, typeReferenceNode);
|
|
1830
242
|
case "Omit": {
|
|
1831
|
-
const option_16 =
|
|
243
|
+
const option_16 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
|
|
1832
244
|
if (option_16 != null) {
|
|
1833
245
|
return option_16;
|
|
1834
246
|
}
|
|
1835
247
|
else {
|
|
1836
|
-
return
|
|
248
|
+
return readOmit(reader, typeReferenceNode);
|
|
1837
249
|
}
|
|
1838
250
|
}
|
|
1839
251
|
case "Pick": {
|
|
1840
|
-
const option_18 =
|
|
252
|
+
const option_18 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
|
|
1841
253
|
if (option_18 != null) {
|
|
1842
254
|
return option_18;
|
|
1843
255
|
}
|
|
1844
256
|
else {
|
|
1845
|
-
return
|
|
257
|
+
return readPick(reader, typeReferenceNode);
|
|
1846
258
|
}
|
|
1847
259
|
}
|
|
1848
260
|
case "Readonly":
|
|
1849
|
-
return
|
|
261
|
+
return readReadonly(reader, typeReferenceNode);
|
|
1850
262
|
default:
|
|
1851
263
|
return readTypeReference_1(true);
|
|
1852
264
|
}
|
|
@@ -1867,8 +279,8 @@ function readFunctionType(reader, typeNode) {
|
|
|
1867
279
|
if (Operators_IsNull(node)) {
|
|
1868
280
|
return acc;
|
|
1869
281
|
}
|
|
1870
|
-
else if (((Operators_IsNull(node.parent) && (node.pos < 0)) && (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]() != null)) && !(node ===
|
|
1871
|
-
node_mut =
|
|
282
|
+
else if (((Operators_IsNull(node.parent) && (node.pos < 0)) && (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]() != null)) && !(node === value_2(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]()))) {
|
|
283
|
+
node_mut = value_2(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]());
|
|
1872
284
|
acc_mut = acc;
|
|
1873
285
|
continue collectEnclosing;
|
|
1874
286
|
}
|
|
@@ -1890,7 +302,7 @@ function readFunctionType(reader, typeNode) {
|
|
|
1890
302
|
GetHashCode: (x) => (stringHash(x) | 0),
|
|
1891
303
|
});
|
|
1892
304
|
typeParameters = (isEmpty(matchValue) ? empty() : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"]((ts.factory).createNodeArray(Array.from(matchValue))));
|
|
1893
|
-
return new GlueType(/* FunctionType */ 15, [new GlueFunctionType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](typeNode), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](functionTypeNode.type), typeParameters, (matchValue_1 = functionTypeNode.typeParameters, (matchValue_1 == null) ? empty() : toList(
|
|
305
|
+
return new GlueType(/* FunctionType */ 15, [new GlueFunctionType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](typeNode), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](functionTypeNode.type), typeParameters, (matchValue_1 = functionTypeNode.typeParameters, (matchValue_1 == null) ? empty() : toList(map_1((typeParameter_1) => identifierText(typeParameter_1.name), matchValue_1))), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](functionTypeNode.parameters))]);
|
|
1894
306
|
}
|
|
1895
307
|
|
|
1896
308
|
function readImportType(reader, typeNode) {
|
|
@@ -1926,7 +338,7 @@ function readImportType(reader, typeNode) {
|
|
|
1926
338
|
else {
|
|
1927
339
|
const moduleName = unresolvedModule;
|
|
1928
340
|
const warning = concat("\'", moduleName, "\' is not installed, the types imported from it are generated as \'obj\'");
|
|
1929
|
-
if (!
|
|
341
|
+
if (!contains(warning, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), {
|
|
1930
342
|
Equals: (x, y) => (x === y),
|
|
1931
343
|
GetHashCode: (x) => (stringHash(x) | 0),
|
|
1932
344
|
})) {
|
|
@@ -1942,7 +354,7 @@ function readThisType(reader, typeNode) {
|
|
|
1942
354
|
const thisTypeNode = typeNode;
|
|
1943
355
|
const typ = checker.getTypeAtLocation(thisTypeNode);
|
|
1944
356
|
const declarations = Operators_IsNull(typ.symbol) ? undefined : typ.symbol.declarations;
|
|
1945
|
-
const typParameters = (declarations == null) ? empty() : defaultArg((option_1 = tryHead(sortByDescending((typeParameters) => (~~typeParameters.length | 0),
|
|
357
|
+
const typParameters = (declarations == null) ? empty() : defaultArg((option_1 = tryHead(sortByDescending((typeParameters) => (~~typeParameters.length | 0), choose((declaration) => {
|
|
1946
358
|
const matchValue = declaration.kind;
|
|
1947
359
|
switch (matchValue) {
|
|
1948
360
|
case 264:
|
|
@@ -1964,301 +376,6 @@ function readThisType(reader, typeNode) {
|
|
|
1964
376
|
}
|
|
1965
377
|
}
|
|
1966
378
|
|
|
1967
|
-
function readIntersectionConstituents(reader, typeNode) {
|
|
1968
|
-
let matchValue;
|
|
1969
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
1970
|
-
const intersectionTypeNode = typeNode;
|
|
1971
|
-
const unionOrIntersectionType = checker.getTypeAtLocation(intersectionTypeNode);
|
|
1972
|
-
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.push(unionOrIntersectionType));
|
|
1973
|
-
const _guard = {
|
|
1974
|
-
Dispose() {
|
|
1975
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.splice(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.length - 1, 1);
|
|
1976
|
-
},
|
|
1977
|
-
};
|
|
1978
|
-
try {
|
|
1979
|
-
const properties_1 = choose((property_1) => {
|
|
1980
|
-
const matchValue_1 = property_1.declarations;
|
|
1981
|
-
if (matchValue_1 == null) {
|
|
1982
|
-
return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
|
|
1983
|
-
}
|
|
1984
|
-
else {
|
|
1985
|
-
const declarations = matchValue_1;
|
|
1986
|
-
if (declarations.length === 1) {
|
|
1987
|
-
return new IntersectionTypePropertyResult(/* Single */ 0, [property_1, item_4(0, declarations)]);
|
|
1988
|
-
}
|
|
1989
|
-
else if (forAll((declaration) => {
|
|
1990
|
-
if (declaration.kind === 172) {
|
|
1991
|
-
return true;
|
|
1992
|
-
}
|
|
1993
|
-
else {
|
|
1994
|
-
return declaration.kind === 173;
|
|
1995
|
-
}
|
|
1996
|
-
}, declarations)) {
|
|
1997
|
-
return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
|
|
1998
|
-
}
|
|
1999
|
-
else {
|
|
2000
|
-
return IntersectionTypePropertyResult.ForceAny;
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
}, unionOrIntersectionType.isUnion() ? List_distinct(concat_1(map_1((arg) => toList(checker.getPropertiesOfType(arg)), toList(unionOrIntersectionType.types))), {
|
|
2004
|
-
Equals: equals,
|
|
2005
|
-
GetHashCode: (x) => (structuralHash(x) | 0),
|
|
2006
|
-
}) : ((matchValue = toList(unionOrIntersectionType.getProperties()), isEmpty(matchValue) ? ((intersectionTypeNode.pos >= 0) ? List_distinctBy((property) => property.name, collect_1((constituent) => {
|
|
2007
|
-
let type_1;
|
|
2008
|
-
return toList((type_1 = checker.getTypeAtLocation(constituent), checker.getPropertiesOfType(type_1)));
|
|
2009
|
-
}, toList(intersectionTypeNode.types)), {
|
|
2010
|
-
Equals: (x_1, y_1) => (x_1 === y_1),
|
|
2011
|
-
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
2012
|
-
}) : matchValue) : matchValue)));
|
|
2013
|
-
const intersectsATypeQuery = exists((constituent_1) => (constituent_1.kind === 187), intersectionTypeNode.types);
|
|
2014
|
-
const everyConstituentIsAReference = forAll((constituent_2) => (constituent_2.kind === 184), intersectionTypeNode.types);
|
|
2015
|
-
const hasUnsupportedProperties = intersectsATypeQuery ? true : exists_1((property_2) => {
|
|
2016
|
-
switch (property_2.tag) {
|
|
2017
|
-
case 1:
|
|
2018
|
-
return false;
|
|
2019
|
-
case 0:
|
|
2020
|
-
if (everyConstituentIsAReference) {
|
|
2021
|
-
return property_2.fields[1].kind === 175;
|
|
2022
|
-
}
|
|
2023
|
-
else {
|
|
2024
|
-
return false;
|
|
2025
|
-
}
|
|
2026
|
-
default:
|
|
2027
|
-
return true;
|
|
2028
|
-
}
|
|
2029
|
-
}, properties_1);
|
|
2030
|
-
const callSignatures = unionOrIntersectionType.isUnion() ? empty() : choose((signature) => {
|
|
2031
|
-
const synthesized = checker.signatureToSignatureDeclaration(signature, 180, typeNode, typeNodeBuilderFlags);
|
|
2032
|
-
if (synthesized == null) {
|
|
2033
|
-
return undefined;
|
|
2034
|
-
}
|
|
2035
|
-
else {
|
|
2036
|
-
const declaration_2 = synthesized;
|
|
2037
|
-
declaration_2.parent = typeNode;
|
|
2038
|
-
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
2039
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_2);
|
|
2040
|
-
try {
|
|
2041
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2);
|
|
2042
|
-
}
|
|
2043
|
-
finally {
|
|
2044
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
}, toList(checker.getSignaturesOfType(unionOrIntersectionType, 0)));
|
|
2048
|
-
if (hasUnsupportedProperties) {
|
|
2049
|
-
const references = map_1((constituent_3) => {
|
|
2050
|
-
if (constituent_3.kind === 184) {
|
|
2051
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_3);
|
|
2052
|
-
}
|
|
2053
|
-
else {
|
|
2054
|
-
return GlueType.Discard;
|
|
2055
|
-
}
|
|
2056
|
-
}, toList(intersectionTypeNode.types));
|
|
2057
|
-
const literalMembers = collect_1((constituent_4) => {
|
|
2058
|
-
if (constituent_4.kind === 188) {
|
|
2059
|
-
const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_4);
|
|
2060
|
-
if (matchValue_2.tag === 22) {
|
|
2061
|
-
return matchValue_2.fields[0].Members;
|
|
2062
|
-
}
|
|
2063
|
-
else {
|
|
2064
|
-
return empty();
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
else {
|
|
2068
|
-
return empty();
|
|
2069
|
-
}
|
|
2070
|
-
}, toList(intersectionTypeNode.types));
|
|
2071
|
-
const inheritable = filter_1((reference) => !equals(reference, GlueType.Discard), references);
|
|
2072
|
-
return (!isEmpty(inheritable) && forAll_1((_arg) => {
|
|
2073
|
-
if (_arg.tag === 13) {
|
|
2074
|
-
return true;
|
|
2075
|
-
}
|
|
2076
|
-
else {
|
|
2077
|
-
return false;
|
|
2078
|
-
}
|
|
2079
|
-
}, inheritable)) ? (new GlueType(/* IntersectionOfReferences */ 21, [inheritable, literalMembers])) : (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
|
|
2080
|
-
}
|
|
2081
|
-
else {
|
|
2082
|
-
return new GlueType(/* IntersectionType */ 20, [append(withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing, typeNode, () => choose((_arg_1) => {
|
|
2083
|
-
switch (_arg_1.tag) {
|
|
2084
|
-
case 1:
|
|
2085
|
-
return readPropertyWithoutDeclaration(reader, typeNode, _arg_1.fields[0]);
|
|
2086
|
-
case 2:
|
|
2087
|
-
throw new Exception("Should not happen here");
|
|
2088
|
-
default:
|
|
2089
|
-
return readInstantiatedMember(reader, typeNode, _arg_1.fields[0], _arg_1.fields[1]);
|
|
2090
|
-
}
|
|
2091
|
-
}, properties_1)), append(callSignatures, collect_1((constituent_5) => {
|
|
2092
|
-
if (constituent_5.kind === 188) {
|
|
2093
|
-
return map_1((declaration_4) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_4), filter_1((element) => (element.kind === 182), toList(constituent_5.members)));
|
|
2094
|
-
}
|
|
2095
|
-
else {
|
|
2096
|
-
return empty();
|
|
2097
|
-
}
|
|
2098
|
-
}, toList(intersectionTypeNode.types))))]);
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
finally {
|
|
2102
|
-
disposeSafe(_guard);
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
function readIntersectionType(reader, typeNode) {
|
|
2107
|
-
const constituents = toList(filter((arg) => {
|
|
2108
|
-
let constituent, this$;
|
|
2109
|
-
return !((constituent = arg, (constituent.kind === 188) && (((this$ = constituent.members, ~~this$.length)) === 0)));
|
|
2110
|
-
}, typeNode.types));
|
|
2111
|
-
let matchResult, single;
|
|
2112
|
-
if (!isEmpty(constituents)) {
|
|
2113
|
-
if (isEmpty(tail(constituents))) {
|
|
2114
|
-
matchResult = 0;
|
|
2115
|
-
single = head(constituents);
|
|
2116
|
-
}
|
|
2117
|
-
else {
|
|
2118
|
-
matchResult = 1;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
else {
|
|
2122
|
-
matchResult = 1;
|
|
2123
|
-
}
|
|
2124
|
-
switch (matchResult) {
|
|
2125
|
-
case 0:
|
|
2126
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
|
|
2127
|
-
default:
|
|
2128
|
-
return readIntersectionConstituents(reader, typeNode);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
function readExpressionWithTypeArguments(reader, typeNode) {
|
|
2133
|
-
let symbol, symbol_2, symbol_3, symbol_4, matchValue_2, option_4, symbol_6, matchValue_3, ofAlias, matchValue_4, matchValue_5, alias, written, option_6;
|
|
2134
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
2135
|
-
const expression = typeNode;
|
|
2136
|
-
const typ = checker.getTypeFromTypeNode(expression);
|
|
2137
|
-
const symbolOpt = orElse(orElse(typ.aliasSymbol, Operators_IsNull(typ.symbol) ? undefined : typ.symbol), checker.getSymbolAtLocation(expression.expression));
|
|
2138
|
-
const isFromEs5 = isFromEs5Lib(symbolOpt);
|
|
2139
|
-
const matchValue = getFullNameOrEmpty(checker, expression.expression);
|
|
2140
|
-
let matchResult;
|
|
2141
|
-
if (isFromEs5) {
|
|
2142
|
-
switch (matchValue) {
|
|
2143
|
-
case "Omit": {
|
|
2144
|
-
matchResult = 0;
|
|
2145
|
-
break;
|
|
2146
|
-
}
|
|
2147
|
-
case "Pick": {
|
|
2148
|
-
matchResult = 1;
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
default:
|
|
2152
|
-
matchResult = 2;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
else {
|
|
2156
|
-
matchResult = 2;
|
|
2157
|
-
}
|
|
2158
|
-
switch (matchResult) {
|
|
2159
|
-
case 0:
|
|
2160
|
-
return UtilityType_readOmit(reader, expression);
|
|
2161
|
-
case 1:
|
|
2162
|
-
return UtilityType_readPick(reader, expression);
|
|
2163
|
-
default: {
|
|
2164
|
-
const isQualified = expression.expression.kind === 212;
|
|
2165
|
-
const name = (symbolOpt != null) ? (((symbol = symbolOpt, symbol.name === "default")) ? ((symbol_2 = symbolOpt, defaultArg(declaredName(symbol_2), symbol_2.name))) : ((!isFromEs5) ? ((symbol_3 = symbolOpt, symbol_3.name)) : (isQualified ? expression.expression.name.text : expression.expression.getText()))) : (isQualified ? expression.expression.name.text : expression.expression.getText());
|
|
2166
|
-
const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
|
|
2167
|
-
if (((symbolOpt == null) ? false : ((symbol_4 = symbolOpt, (symbol_4.name === "__type") ? true : (symbol_4.name === "__object")))) ? true : ((isExternal && !FSharpSet__Contains(knownExternalTypeNames, name)) && !(isFromEs5 && (name === "Partial")))) {
|
|
2168
|
-
return GlueType.Discard;
|
|
2169
|
-
}
|
|
2170
|
-
else {
|
|
2171
|
-
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name.indexOf(".") >= 0) ? name : sanitizeTypeName(name), (matchValue_2 = ((option_4 = symbolOpt, (option_4 != null) ? resolveAlias(checker, option_4) : undefined)), (matchValue_2 == null) ? getFullNameOrEmpty(checker, expression.expression) : ((symbol_6 = matchValue_2, checker.getFullyQualifiedName(symbol_6)))), isLibraryName(reader, name) ? empty() : modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), isQualified ? true : crossesNamespace(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt, landingOf(reader, expression)), symbolOpt), (matchValue_3 = readTypeArguments(reader, expression), isEmpty(matchValue_3) ? ((ofAlias = (((matchValue_4 = checker.getSymbolAtLocation(expression.expression), (matchValue_5 = typ.aliasSymbol, (matchValue_4 != null) && ((matchValue_5 != null) && ((alias = matchValue_5, (written = matchValue_4, !(written === alias)))))))) ? defaultArg((option_6 = typ.aliasTypeArguments, (option_6 != null) ? toList(option_6) : undefined), empty()) : empty()), map_1((argument) => {
|
|
2172
|
-
const typNode = checker.typeToTypeNode(argument, undefined, typeNodeBuilderFlags);
|
|
2173
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
|
|
2174
|
-
}, isEmpty(ofAlias) ? resolvedBaseTypeArguments(checker, expression) : ofAlias))) : matchValue_3), (isFromEs5 ? true : isExternal) ? true : isLibraryName(reader, name))]);
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
function readConditionalType(reader, typeNode) {
|
|
2181
|
-
let branch, trueType, falseType;
|
|
2182
|
-
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
2183
|
-
const conditionalTypeNode = typeNode;
|
|
2184
|
-
const typ = checker.getTypeAtLocation(conditionalTypeNode);
|
|
2185
|
-
if (isDeferredConditional(typ)) {
|
|
2186
|
-
const resolved = isAnyTypeParameter(reader, conditionalTypeNode.checkType) ? ((branch = ((node) => {
|
|
2187
|
-
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node);
|
|
2188
|
-
let matchResult, glueType;
|
|
2189
|
-
if (matchValue.tag === 8) {
|
|
2190
|
-
if (matchValue.fields[0].tag === 4) {
|
|
2191
|
-
matchResult = 0;
|
|
2192
|
-
}
|
|
2193
|
-
else {
|
|
2194
|
-
matchResult = 1;
|
|
2195
|
-
glueType = matchValue;
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
else {
|
|
2199
|
-
matchResult = 1;
|
|
2200
|
-
glueType = matchValue;
|
|
2201
|
-
}
|
|
2202
|
-
switch (matchResult) {
|
|
2203
|
-
case 0:
|
|
2204
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Null]);
|
|
2205
|
-
default:
|
|
2206
|
-
return glueType;
|
|
2207
|
-
}
|
|
2208
|
-
}), (trueType = branch(conditionalTypeNode.trueType), (falseType = branch(conditionalTypeNode.falseType), equals(trueType, falseType) ? trueType : (new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([trueType, falseType]))])))))) : tryResolveDeferred(reader, typeNode);
|
|
2209
|
-
if (resolved == null) {
|
|
2210
|
-
const warningsCount = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length | 0;
|
|
2211
|
-
const inferred = List_distinctBy((_arg) => _arg.Name, map_1((inferTypeNode) => (new GlueTypeParameter(inferTypeNode.typeParameter.name.getText(), inferredConstraint(reader, inferTypeNode), undefined)), inferTypeNodes(conditionalTypeNode.extendsType)), {
|
|
2212
|
-
Equals: (x, y) => (x === y),
|
|
2213
|
-
GetHashCode: (x) => (stringHash(x) | 0),
|
|
2214
|
-
});
|
|
2215
|
-
const conditionalType = new GlueConditionalType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.checkType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.extendsType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.trueType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.falseType), inferred);
|
|
2216
|
-
if (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length > warningsCount) {
|
|
2217
|
-
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().splice(warningsCount, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length - warningsCount);
|
|
2218
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
2219
|
-
}
|
|
2220
|
-
else {
|
|
2221
|
-
return new GlueType(/* ConditionalType */ 33, [conditionalType]);
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
else {
|
|
2225
|
-
return resolved;
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
else {
|
|
2229
|
-
const matchValue_1 = typ.flags;
|
|
2230
|
-
if ($007CHasTypeFlags$007C_$007C(524288, matchValue_1) != null) {
|
|
2231
|
-
return new GlueType(/* TypeParameter */ 16, [typ.symbol.name]);
|
|
2232
|
-
}
|
|
2233
|
-
else if ($007CHasTypeFlags$007C_$007C(8192, matchValue_1) != null) {
|
|
2234
|
-
return new GlueType(/* Literal */ 8, [new GlueLiteral(/* Bool */ 3, [typ.intrinsicName === "true"])]);
|
|
2235
|
-
}
|
|
2236
|
-
else {
|
|
2237
|
-
const matchValue_2 = readTypeUsingFlags(reader, typ);
|
|
2238
|
-
let matchResult_1, forward;
|
|
2239
|
-
if (matchValue_2.tag === 3) {
|
|
2240
|
-
if (matchValue_2.fields[0].tag === 6) {
|
|
2241
|
-
matchResult_1 = 0;
|
|
2242
|
-
}
|
|
2243
|
-
else {
|
|
2244
|
-
matchResult_1 = 1;
|
|
2245
|
-
forward = matchValue_2;
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
else {
|
|
2249
|
-
matchResult_1 = 1;
|
|
2250
|
-
forward = matchValue_2;
|
|
2251
|
-
}
|
|
2252
|
-
switch (matchResult_1) {
|
|
2253
|
-
case 0:
|
|
2254
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.checkType);
|
|
2255
|
-
default:
|
|
2256
|
-
return forward;
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
379
|
function readTemplateLiteralType(reader, typeNode) {
|
|
2263
380
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
2264
381
|
const templateLiteralTypeNode = typeNode;
|
|
@@ -2274,7 +391,7 @@ function readTemplateLiteralType(reader, typeNode) {
|
|
|
2274
391
|
}
|
|
2275
392
|
}
|
|
2276
393
|
else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
|
|
2277
|
-
return
|
|
394
|
+
return collect(readResolvedLiterals, toList(typ_1.types));
|
|
2278
395
|
}
|
|
2279
396
|
else {
|
|
2280
397
|
return empty();
|
|
@@ -2295,6 +412,7 @@ function readTemplateLiteralType(reader, typeNode) {
|
|
|
2295
412
|
}
|
|
2296
413
|
|
|
2297
414
|
export function readTypeNode(reader, typeNode) {
|
|
415
|
+
let constraintNode, typeParameters_1;
|
|
2298
416
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
2299
417
|
const matchValue = typeNode.kind;
|
|
2300
418
|
switch (matchValue) {
|
|
@@ -2306,6 +424,49 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2306
424
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
2307
425
|
case 136:
|
|
2308
426
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
|
|
427
|
+
case 141: {
|
|
428
|
+
const typeParameters = Operators_IsNull(typeNode.parent) ? undefined : typeNode.parent.typeParameters;
|
|
429
|
+
let matchResult, typeParameters_2;
|
|
430
|
+
if (typeParameters != null) {
|
|
431
|
+
if ((typeParameters_1 = typeParameters, ~~typeParameters_1.length === 1)) {
|
|
432
|
+
matchResult = 0;
|
|
433
|
+
typeParameters_2 = typeParameters;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
matchResult = 1;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
matchResult = 1;
|
|
441
|
+
}
|
|
442
|
+
switch (matchResult) {
|
|
443
|
+
case 0: {
|
|
444
|
+
const typeParameter = typeParameters_2[0];
|
|
445
|
+
const matchValue_5 = typeParameter.constraint;
|
|
446
|
+
let matchResult_1, constraintNode_1;
|
|
447
|
+
if (matchValue_5 != null) {
|
|
448
|
+
if ((constraintNode = matchValue_5, constraintNode.kind === 154)) {
|
|
449
|
+
matchResult_1 = 0;
|
|
450
|
+
constraintNode_1 = matchValue_5;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
matchResult_1 = 1;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
matchResult_1 = 1;
|
|
458
|
+
}
|
|
459
|
+
switch (matchResult_1) {
|
|
460
|
+
case 0:
|
|
461
|
+
return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
|
|
462
|
+
default:
|
|
463
|
+
return new GlueType(/* TypeParameter */ 16, [identifierText(typeParameter.name)]);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
default:
|
|
467
|
+
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
2309
470
|
case 146:
|
|
2310
471
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Never]);
|
|
2311
472
|
case 150:
|
|
@@ -2343,7 +504,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2343
504
|
return readTypeQueryNode(reader, typeNode);
|
|
2344
505
|
case 188: {
|
|
2345
506
|
const typeLiteralNode = typeNode;
|
|
2346
|
-
return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(
|
|
507
|
+
return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(map((declaration) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration), toList(typeLiteralNode.members)), typeLiteralId(typeLiteralNode))]);
|
|
2347
508
|
}
|
|
2348
509
|
case 189: {
|
|
2349
510
|
const arrayTypeNode = typeNode;
|
|
@@ -2351,9 +512,9 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2351
512
|
}
|
|
2352
513
|
case 190: {
|
|
2353
514
|
const tupleTypeNode = typeNode;
|
|
2354
|
-
const elements =
|
|
515
|
+
const elements = map((value) => value, toList(tupleTypeNode.elements));
|
|
2355
516
|
if (exists_1((element) => (element.kind === 192), elements)) {
|
|
2356
|
-
const elementTypes = List_distinct(
|
|
517
|
+
const elementTypes = List_distinct(map((element_1) => {
|
|
2357
518
|
if (element_1.kind === 192) {
|
|
2358
519
|
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type);
|
|
2359
520
|
if (matchValue_3.tag === 14) {
|
|
@@ -2370,20 +531,20 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2370
531
|
Equals: equals,
|
|
2371
532
|
GetHashCode: (x) => (safeHash(x) | 0),
|
|
2372
533
|
});
|
|
2373
|
-
let
|
|
534
|
+
let matchResult_2, elementType_2;
|
|
2374
535
|
if (!isEmpty(elementTypes)) {
|
|
2375
536
|
if (isEmpty(tail(elementTypes))) {
|
|
2376
|
-
|
|
537
|
+
matchResult_2 = 0;
|
|
2377
538
|
elementType_2 = head(elementTypes);
|
|
2378
539
|
}
|
|
2379
540
|
else {
|
|
2380
|
-
|
|
541
|
+
matchResult_2 = 1;
|
|
2381
542
|
}
|
|
2382
543
|
}
|
|
2383
544
|
else {
|
|
2384
|
-
|
|
545
|
+
matchResult_2 = 1;
|
|
2385
546
|
}
|
|
2386
|
-
switch (
|
|
547
|
+
switch (matchResult_2) {
|
|
2387
548
|
case 0:
|
|
2388
549
|
return new GlueType(/* Array */ 14, [elementType_2]);
|
|
2389
550
|
default:
|
|
@@ -2391,7 +552,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2391
552
|
}
|
|
2392
553
|
}
|
|
2393
554
|
else {
|
|
2394
|
-
return new GlueType(/* TupleType */ 18, [
|
|
555
|
+
return new GlueType(/* TupleType */ 18, [map((typNode) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode), elements)]);
|
|
2395
556
|
}
|
|
2396
557
|
}
|
|
2397
558
|
case 191: {
|
|
@@ -2408,20 +569,20 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2408
569
|
}
|
|
2409
570
|
else if (exists(isGlobalThisQuery, typeNode.types)) {
|
|
2410
571
|
const matchValue_4 = toList(filter((arg) => !isGlobalThisQuery(arg), typeNode.types));
|
|
2411
|
-
let
|
|
572
|
+
let matchResult_3, single;
|
|
2412
573
|
if (!isEmpty(matchValue_4)) {
|
|
2413
574
|
if (isEmpty(tail(matchValue_4))) {
|
|
2414
|
-
|
|
575
|
+
matchResult_3 = 0;
|
|
2415
576
|
single = head(matchValue_4);
|
|
2416
577
|
}
|
|
2417
578
|
else {
|
|
2418
|
-
|
|
579
|
+
matchResult_3 = 1;
|
|
2419
580
|
}
|
|
2420
581
|
}
|
|
2421
582
|
else {
|
|
2422
|
-
|
|
583
|
+
matchResult_3 = 1;
|
|
2423
584
|
}
|
|
2424
|
-
switch (
|
|
585
|
+
switch (matchResult_3) {
|
|
2425
586
|
case 0:
|
|
2426
587
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
|
|
2427
588
|
default:
|
|
@@ -2455,7 +616,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2455
616
|
const literalTypeNode = typeNode;
|
|
2456
617
|
const matchValue_2 = tryReadLiteral(checker, literalTypeNode.literal);
|
|
2457
618
|
if (matchValue_2 == null) {
|
|
2458
|
-
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs",
|
|
619
|
+
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 451));
|
|
2459
620
|
}
|
|
2460
621
|
else {
|
|
2461
622
|
return new GlueType(/* Literal */ 8, [matchValue_2]);
|
|
@@ -2470,7 +631,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
2470
631
|
case 234:
|
|
2471
632
|
return readExpressionWithTypeArguments(reader, typeNode);
|
|
2472
633
|
default: {
|
|
2473
|
-
const item = Report_readerError_Z19516DCE("type node", concat("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(typeNode.kind)), typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs",
|
|
634
|
+
const item = Report_readerError_Z19516DCE("type node", concat("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(typeNode.kind)), typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 595);
|
|
2474
635
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
2475
636
|
void (objectArg.push(item));
|
|
2476
637
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|