@glutinum/cli 1.0.0-beta.14 → 1.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Glutinum.Converter/GlueAST.js +19 -14
- package/dist/Glutinum.Converter/Merge.js +490 -206
- package/dist/Glutinum.Converter/Packages.js +2 -2
- package/dist/Glutinum.Converter/Printer.js +26 -21
- package/dist/Glutinum.Converter/Read.js +377 -169
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
- package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
- package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +31 -26
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
- package/dist/Glutinum.Converter/Reader/Node.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +292 -30
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
- package/dist/Glutinum.Converter/Reader/UtilityType.js +179 -34
- package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
- package/dist/Glutinum.Converter/Transform.js +1073 -638
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
- package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
- package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
- package/dist/Glutinum.Converter/Transformer/Heritage.js +449 -17
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@ export function readNode(reader, node) {
|
|
|
44
44
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadExportAssignmentZ3497D0FE"](node);
|
|
45
45
|
case 282: {
|
|
46
46
|
const exportSpecifier = node;
|
|
47
|
-
return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration = item(0, declarations_1), (declaration_1 = ((declaration.kind === 261) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration.parent.parent) : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration)), (matchValue_2 = exportSpecifier.propertyName, (matchValue_2 == null) ? declaration_1 : (new GlueType(/* ReExport */
|
|
47
|
+
return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration = item(0, declarations_1), (declaration_1 = ((declaration.kind === 261) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration.parent.parent) : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration)), (matchValue_2 = exportSpecifier.propertyName, (matchValue_2 == null) ? declaration_1 : (new GlueType(/* ReExport */ 33, [new GlueReExport(moduleExportNameText(exportSpecifier.name), declaration_1, empty())]))))))) : undefined) : undefined))) : undefined), GlueType.Discard);
|
|
48
48
|
}
|
|
49
49
|
default: {
|
|
50
50
|
const warning = Report_readerError_Z19516DCE("node", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue)), node, "/_//src/Glutinum.Converter/Reader/Node.fs", 83);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { unwrap, orElse, value as value_2, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
3
|
+
import { tryReadLiteral, typeLiteralId, declaredName, isFromEsLib, Type_StringLiteral_$007CString$007COther$007C, isFromEs5Lib, entityNameText, readTypeArguments, landingOf, crossesNamespace, modulePathForSymbol, isLibraryName, getFullNameOrEmpty, knownExternalTypeNames, isExternalToPackages, importedName, identifierText, typeNodeBuilderFlags, $007CHasSymbolFlags$007C_$007C, symbolAtLocation, $007CHasTypeFlags$007C_$007C, resolveAlias } from "./Utils.js";
|
|
4
|
+
import { filter, choose, sortByDescending, tryHead, map as map_1, toList, exists, forAll, tryPick } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
|
+
import { exists as exists_1, collect, head, tail, isEmpty, map, append, fold, singleton, empty, length, mapIndexed } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
6
|
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";
|
|
7
|
+
import { tryReadInstanceType, readReadonly, readPick, readOmit, readThisParameterType, readReturnType, readRecord, readPartial, readExclude, tryExpandAnonymousObjectApplication } from "./UtilityType.js";
|
|
6
8
|
import { contains, item as item_1 } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
7
9
|
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.21.0/Seq.js";
|
|
9
10
|
import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
10
11
|
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.21.0/List.js";
|
|
12
12
|
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
|
|
13
13
|
import { List_distinct, List_distinctBy } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
14
14
|
import { Exception, safeHash, equals, comparePrimitives, stringHash } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
@@ -21,6 +21,94 @@ import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
|
21
21
|
import { readExpressionWithTypeArguments } from "./ExpressionWithTypeArguments.js";
|
|
22
22
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
23
23
|
|
|
24
|
+
function widenLiteralArguments(reader, symbolOpt, typeReferenceNode, typeArguments) {
|
|
25
|
+
let symbol, nodes;
|
|
26
|
+
let declaredTypeParameters;
|
|
27
|
+
let option_6;
|
|
28
|
+
let option_4;
|
|
29
|
+
const option_2 = symbolOpt;
|
|
30
|
+
option_4 = ((option_2 != null) ? ((symbol = option_2, defaultArg(resolveAlias(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), symbol), symbol))) : undefined);
|
|
31
|
+
if (option_4 != null) {
|
|
32
|
+
const symbol_1 = option_4;
|
|
33
|
+
option_6 = symbol_1.declarations;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
option_6 = undefined;
|
|
37
|
+
}
|
|
38
|
+
declaredTypeParameters = ((option_6 != null) ? tryPick((declaration) => declaration.typeParameters, option_6) : undefined);
|
|
39
|
+
const matchValue_2 = typeReferenceNode.typeArguments;
|
|
40
|
+
let matchResult, nodes_1, typeParameters_2;
|
|
41
|
+
if (matchValue_2 != null) {
|
|
42
|
+
if (declaredTypeParameters != null) {
|
|
43
|
+
if ((nodes = matchValue_2, ~~nodes.length === length(typeArguments))) {
|
|
44
|
+
matchResult = 0;
|
|
45
|
+
nodes_1 = matchValue_2;
|
|
46
|
+
typeParameters_2 = declaredTypeParameters;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
matchResult = 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
matchResult = 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
matchResult = 1;
|
|
58
|
+
}
|
|
59
|
+
switch (matchResult) {
|
|
60
|
+
case 0:
|
|
61
|
+
return mapIndexed((index, typeArgument) => {
|
|
62
|
+
let node, typ, isLiteralType, matchValue_1, constraint_, matchValue_4, symbol_2, matchValue_5;
|
|
63
|
+
if ((index < ~~typeParameters_2.length) && ((node = (nodes_1[index]), (node.pos >= 0) && ((typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(node), (isLiteralType = ((typ_1) => {
|
|
64
|
+
const matchValue = typ_1.flags;
|
|
65
|
+
let matchResult_1;
|
|
66
|
+
if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
|
|
67
|
+
matchResult_1 = 0;
|
|
68
|
+
}
|
|
69
|
+
else if ($007CHasTypeFlags$007C_$007C(2048, matchValue) != null) {
|
|
70
|
+
matchResult_1 = 0;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
matchResult_1 = 1;
|
|
74
|
+
}
|
|
75
|
+
switch (matchResult_1) {
|
|
76
|
+
case 0:
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}), (matchValue_1 = typ.flags, ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) ? forAll(isLiteralType, typ.types) : isLiteralType(typ)))))))) {
|
|
82
|
+
const matchValue_6 = (typeParameters_2[index]).constraint;
|
|
83
|
+
let matchResult_2, constraint__2;
|
|
84
|
+
if (matchValue_6 != null) {
|
|
85
|
+
if ((constraint_ = matchValue_6, ((constraint_.kind === 184) && (constraint_.typeArguments == null)) && ((matchValue_4 = symbolAtLocation(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), constraint_.typeName), (matchValue_4 == null) ? false : ((symbol_2 = matchValue_4, (matchValue_5 = symbol_2.flags, !($007CHasSymbolFlags$007C_$007C(262144, matchValue_5) != null)))))))) {
|
|
86
|
+
matchResult_2 = 0;
|
|
87
|
+
constraint__2 = matchValue_6;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
matchResult_2 = 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
matchResult_2 = 1;
|
|
95
|
+
}
|
|
96
|
+
switch (matchResult_2) {
|
|
97
|
+
case 0:
|
|
98
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraint__2);
|
|
99
|
+
default:
|
|
100
|
+
return typeArgument;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return typeArgument;
|
|
105
|
+
}
|
|
106
|
+
}, typeArguments);
|
|
107
|
+
default:
|
|
108
|
+
return typeArguments;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
24
112
|
function readTypeReference(reader, typeNode) {
|
|
25
113
|
let option_13, symbol_4;
|
|
26
114
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
@@ -125,7 +213,7 @@ function readTypeReference(reader, typeNode) {
|
|
|
125
213
|
const symbol_3 = symbolOpt;
|
|
126
214
|
name = defaultArg(orElse(importedName(checker, symbol_3), (option_9 = symbol_3.valueDeclaration, (option_9 != null) ? ((valueDeclaration = option_9, (matchValue_5 = valueDeclaration.kind, (matchValue_5 === 267) ? (isQualified ? symbol_3.name : writtenName()) : ((matchValue_5 === 307) ? (valueDeclaration.symbol.parent.getName()) : writtenName())))) : undefined)), writtenName());
|
|
127
215
|
}
|
|
128
|
-
const isUnresolved = (
|
|
216
|
+
const isUnresolved = (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && (symbolOpt == null);
|
|
129
217
|
const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
|
|
130
218
|
if ((((name === "...") ? true : ((matchValue_6 = typeReferenceNode.typeArguments, (matchValue_6 == null) ? false : exists((typeArgument) => {
|
|
131
219
|
if (typeArgument.kind === 184) {
|
|
@@ -138,7 +226,7 @@ function readTypeReference(reader, typeNode) {
|
|
|
138
226
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
139
227
|
}
|
|
140
228
|
else {
|
|
141
|
-
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name.indexOf(".") >= 0) ? name : sanitizeTypeName(name), getFullNameOrEmpty(checker, typeReferenceNode.typeName), 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, typeNode)), symbolOpt), truncateToDeclaredArity(reader, symbolOpt, readTypeArguments(reader, typeReferenceNode)), (isStandardLibrary ? true : isExternal) ? true : isLibraryName(reader, name))]);
|
|
229
|
+
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name.indexOf(".") >= 0) ? name : sanitizeTypeName(name), getFullNameOrEmpty(checker, typeReferenceNode.typeName), 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, typeNode)), symbolOpt), truncateToDeclaredArity(reader, symbolOpt, widenLiteralArguments(reader, symbolOpt, typeReferenceNode, readTypeArguments(reader, typeReferenceNode))), (isStandardLibrary ? true : isExternal) ? true : isLibraryName(reader, name))]);
|
|
142
230
|
}
|
|
143
231
|
}
|
|
144
232
|
else {
|
|
@@ -151,13 +239,72 @@ function readTypeReference(reader, typeNode) {
|
|
|
151
239
|
}
|
|
152
240
|
else if (isFromEs5Lib(symbolOpt)) {
|
|
153
241
|
const matchValue_10 = getFullNameOrEmpty(checker, typeReferenceNode.typeName);
|
|
242
|
+
let matchResult_2;
|
|
154
243
|
switch (matchValue_10) {
|
|
155
|
-
case "Exclude":
|
|
156
|
-
|
|
244
|
+
case "Exclude": {
|
|
245
|
+
matchResult_2 = 0;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
157
248
|
case "Uppercase":
|
|
158
249
|
case "Lowercase":
|
|
159
250
|
case "Capitalize":
|
|
160
251
|
case "Uncapitalize": {
|
|
252
|
+
matchResult_2 = 1;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case "Partial": {
|
|
256
|
+
matchResult_2 = 2;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case "Record": {
|
|
260
|
+
matchResult_2 = 3;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "ReturnType": {
|
|
264
|
+
matchResult_2 = 4;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case "ThisParameterType": {
|
|
268
|
+
matchResult_2 = 5;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
case "Omit": {
|
|
272
|
+
matchResult_2 = 6;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case "Pick": {
|
|
276
|
+
matchResult_2 = 7;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case "Readonly": {
|
|
280
|
+
matchResult_2 = 8;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
case "InstanceType": {
|
|
284
|
+
if (typeReferenceNode.typeArguments != null) {
|
|
285
|
+
matchResult_2 = 9;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
matchResult_2 = 11;
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case "Awaited": {
|
|
293
|
+
if (typeReferenceNode.typeArguments != null) {
|
|
294
|
+
matchResult_2 = 10;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
matchResult_2 = 11;
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
default:
|
|
302
|
+
matchResult_2 = 11;
|
|
303
|
+
}
|
|
304
|
+
switch (matchResult_2) {
|
|
305
|
+
case 0:
|
|
306
|
+
return readExclude(reader, typeReferenceNode);
|
|
307
|
+
case 1: {
|
|
161
308
|
const literals = (typ_1) => {
|
|
162
309
|
const matchValue_7 = typ_1.flags;
|
|
163
310
|
if ($007CHasTypeFlags$007C_$007C(1024, matchValue_7) != null) {
|
|
@@ -171,21 +318,21 @@ function readTypeReference(reader, typeNode) {
|
|
|
171
318
|
}
|
|
172
319
|
else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_7) != null) {
|
|
173
320
|
return fold((acc, cases) => {
|
|
174
|
-
let
|
|
321
|
+
let matchResult_3, acc_1, cases_1;
|
|
175
322
|
if (acc != null) {
|
|
176
323
|
if (cases != null) {
|
|
177
|
-
|
|
324
|
+
matchResult_3 = 0;
|
|
178
325
|
acc_1 = acc;
|
|
179
326
|
cases_1 = cases;
|
|
180
327
|
}
|
|
181
328
|
else {
|
|
182
|
-
|
|
329
|
+
matchResult_3 = 1;
|
|
183
330
|
}
|
|
184
331
|
}
|
|
185
332
|
else {
|
|
186
|
-
|
|
333
|
+
matchResult_3 = 1;
|
|
187
334
|
}
|
|
188
|
-
switch (
|
|
335
|
+
switch (matchResult_3) {
|
|
189
336
|
case 0:
|
|
190
337
|
return append(acc_1, cases_1);
|
|
191
338
|
default:
|
|
@@ -202,26 +349,26 @@ function readTypeReference(reader, typeNode) {
|
|
|
202
349
|
}
|
|
203
350
|
else {
|
|
204
351
|
const matchValue_9 = literals(checker.getTypeFromTypeNode(typeReferenceNode));
|
|
205
|
-
let
|
|
352
|
+
let matchResult_4, single, cases_2;
|
|
206
353
|
if (matchValue_9 != null) {
|
|
207
354
|
if (!isEmpty(matchValue_9)) {
|
|
208
355
|
if (isEmpty(tail(matchValue_9))) {
|
|
209
|
-
|
|
356
|
+
matchResult_4 = 0;
|
|
210
357
|
single = head(matchValue_9);
|
|
211
358
|
}
|
|
212
359
|
else {
|
|
213
|
-
|
|
360
|
+
matchResult_4 = 1;
|
|
214
361
|
cases_2 = matchValue_9;
|
|
215
362
|
}
|
|
216
363
|
}
|
|
217
364
|
else {
|
|
218
|
-
|
|
365
|
+
matchResult_4 = 2;
|
|
219
366
|
}
|
|
220
367
|
}
|
|
221
368
|
else {
|
|
222
|
-
|
|
369
|
+
matchResult_4 = 2;
|
|
223
370
|
}
|
|
224
|
-
switch (
|
|
371
|
+
switch (matchResult_4) {
|
|
225
372
|
case 0:
|
|
226
373
|
return single;
|
|
227
374
|
case 1:
|
|
@@ -231,15 +378,15 @@ function readTypeReference(reader, typeNode) {
|
|
|
231
378
|
}
|
|
232
379
|
}
|
|
233
380
|
}
|
|
234
|
-
case
|
|
381
|
+
case 2:
|
|
235
382
|
return readPartial(reader, typeReferenceNode);
|
|
236
|
-
case
|
|
383
|
+
case 3:
|
|
237
384
|
return readRecord(reader, typeReferenceNode);
|
|
238
|
-
case
|
|
385
|
+
case 4:
|
|
239
386
|
return readReturnType(reader, typeReferenceNode);
|
|
240
|
-
case
|
|
387
|
+
case 5:
|
|
241
388
|
return readThisParameterType(reader, typeReferenceNode);
|
|
242
|
-
case
|
|
389
|
+
case 6: {
|
|
243
390
|
const option_16 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
|
|
244
391
|
if (option_16 != null) {
|
|
245
392
|
return option_16;
|
|
@@ -248,7 +395,7 @@ function readTypeReference(reader, typeNode) {
|
|
|
248
395
|
return readOmit(reader, typeReferenceNode);
|
|
249
396
|
}
|
|
250
397
|
}
|
|
251
|
-
case
|
|
398
|
+
case 7: {
|
|
252
399
|
const option_18 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
|
|
253
400
|
if (option_18 != null) {
|
|
254
401
|
return option_18;
|
|
@@ -257,8 +404,123 @@ function readTypeReference(reader, typeNode) {
|
|
|
257
404
|
return readPick(reader, typeReferenceNode);
|
|
258
405
|
}
|
|
259
406
|
}
|
|
260
|
-
case
|
|
407
|
+
case 8:
|
|
261
408
|
return readReadonly(reader, typeReferenceNode);
|
|
409
|
+
case 9: {
|
|
410
|
+
const matchValue_11 = readTypeReference_1(true);
|
|
411
|
+
let matchResult_5, unresolved, resolved;
|
|
412
|
+
switch (matchValue_11.tag) {
|
|
413
|
+
case 13: {
|
|
414
|
+
if (matchValue_11.fields[0].Name === "InstanceType") {
|
|
415
|
+
matchResult_5 = 0;
|
|
416
|
+
unresolved = matchValue_11;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
matchResult_5 = 1;
|
|
420
|
+
resolved = matchValue_11;
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case 3: {
|
|
425
|
+
if (matchValue_11.fields[0].tag === 6) {
|
|
426
|
+
matchResult_5 = 0;
|
|
427
|
+
unresolved = matchValue_11;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
matchResult_5 = 1;
|
|
431
|
+
resolved = matchValue_11;
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
default: {
|
|
436
|
+
matchResult_5 = 1;
|
|
437
|
+
resolved = matchValue_11;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
switch (matchResult_5) {
|
|
441
|
+
case 0:
|
|
442
|
+
return defaultArg(tryReadInstanceType(reader, typeReferenceNode), unresolved);
|
|
443
|
+
default:
|
|
444
|
+
return resolved;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
case 10: {
|
|
448
|
+
const awaited = (glueType_1_mut) => {
|
|
449
|
+
awaited:
|
|
450
|
+
while (true) {
|
|
451
|
+
const glueType_1 = glueType_1_mut;
|
|
452
|
+
let matchResult_6, result, glueType_2;
|
|
453
|
+
if (glueType_1.tag === 13) {
|
|
454
|
+
switch (glueType_1.fields[0].Name) {
|
|
455
|
+
case "Promise": {
|
|
456
|
+
if (!isEmpty(glueType_1.fields[0].TypeArguments)) {
|
|
457
|
+
if (isEmpty(tail(glueType_1.fields[0].TypeArguments))) {
|
|
458
|
+
if (glueType_1.fields[0].IsStandardLibrary) {
|
|
459
|
+
matchResult_6 = 0;
|
|
460
|
+
result = head(glueType_1.fields[0].TypeArguments);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
matchResult_6 = 1;
|
|
464
|
+
glueType_2 = glueType_1;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
matchResult_6 = 1;
|
|
469
|
+
glueType_2 = glueType_1;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
matchResult_6 = 1;
|
|
474
|
+
glueType_2 = glueType_1;
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
case "PromiseLike": {
|
|
479
|
+
if (!isEmpty(glueType_1.fields[0].TypeArguments)) {
|
|
480
|
+
if (isEmpty(tail(glueType_1.fields[0].TypeArguments))) {
|
|
481
|
+
if (glueType_1.fields[0].IsStandardLibrary) {
|
|
482
|
+
matchResult_6 = 0;
|
|
483
|
+
result = head(glueType_1.fields[0].TypeArguments);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
matchResult_6 = 1;
|
|
487
|
+
glueType_2 = glueType_1;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
matchResult_6 = 1;
|
|
492
|
+
glueType_2 = glueType_1;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
matchResult_6 = 1;
|
|
497
|
+
glueType_2 = glueType_1;
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
default: {
|
|
502
|
+
matchResult_6 = 1;
|
|
503
|
+
glueType_2 = glueType_1;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
matchResult_6 = 1;
|
|
509
|
+
glueType_2 = glueType_1;
|
|
510
|
+
}
|
|
511
|
+
switch (matchResult_6) {
|
|
512
|
+
case 0: {
|
|
513
|
+
glueType_1_mut = result;
|
|
514
|
+
continue awaited;
|
|
515
|
+
}
|
|
516
|
+
default:
|
|
517
|
+
return glueType_2;
|
|
518
|
+
}
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
return awaited(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_2(typeReferenceNode.typeArguments)[0]));
|
|
523
|
+
}
|
|
262
524
|
default:
|
|
263
525
|
return readTypeReference_1(true);
|
|
264
526
|
}
|
|
@@ -595,7 +857,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
595
857
|
case 195:
|
|
596
858
|
return readConditionalType(reader, typeNode);
|
|
597
859
|
case 196:
|
|
598
|
-
return new GlueType(/* TypeParameter */ 16, [typeNode.typeParameter.name.
|
|
860
|
+
return new GlueType(/* TypeParameter */ 16, [typeNode.typeParameter.name.text]);
|
|
599
861
|
case 197: {
|
|
600
862
|
const parenthesizedTypeNode = typeNode;
|
|
601
863
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](parenthesizedTypeNode.type);
|
|
@@ -616,7 +878,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
616
878
|
const literalTypeNode = typeNode;
|
|
617
879
|
const matchValue_2 = tryReadLiteral(checker, literalTypeNode.literal);
|
|
618
880
|
if (matchValue_2 == null) {
|
|
619
|
-
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs",
|
|
881
|
+
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 538));
|
|
620
882
|
}
|
|
621
883
|
else {
|
|
622
884
|
return new GlueType(/* Literal */ 8, [matchValue_2]);
|
|
@@ -631,7 +893,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
631
893
|
case 234:
|
|
632
894
|
return readExpressionWithTypeArguments(reader, typeNode);
|
|
633
895
|
default: {
|
|
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",
|
|
896
|
+
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", 682);
|
|
635
897
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
636
898
|
void (objectArg.push(item));
|
|
637
899
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
@@ -120,7 +120,7 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
case 148:
|
|
123
|
-
return new GlueType(/* ReadOnly */
|
|
123
|
+
return new GlueType(/* ReadOnly */ 31, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type)]);
|
|
124
124
|
case 158:
|
|
125
125
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type);
|
|
126
126
|
default: {
|