@glutinum/cli 0.14.1 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +16 -0
  2. package/dist/Glutinum.Converter/Abbreviations.js +9 -32
  3. package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
  4. package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
  5. package/dist/Glutinum.Converter/FsharpAST.js +154 -69
  6. package/dist/Glutinum.Converter/Generate.js +44 -23
  7. package/dist/Glutinum.Converter/GlueAST.js +122 -74
  8. package/dist/Glutinum.Converter/Hosting.js +892 -0
  9. package/dist/Glutinum.Converter/Merge.js +469 -301
  10. package/dist/Glutinum.Converter/Packages.js +403 -77
  11. package/dist/Glutinum.Converter/Printer.js +455 -388
  12. package/dist/Glutinum.Converter/Read.js +366 -104
  13. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +9 -9
  14. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
  15. package/dist/Glutinum.Converter/Reader/Declaration.js +24 -30
  16. package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
  17. package/dist/Glutinum.Converter/Reader/Documentation.js +56 -67
  18. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +105 -38
  19. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +52 -55
  20. package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
  21. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +28 -16
  22. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +46 -45
  23. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +48 -5
  24. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
  25. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
  26. package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
  27. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +55 -7
  28. package/dist/Glutinum.Converter/Reader/Node.js +23 -26
  29. package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
  30. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
  31. package/dist/Glutinum.Converter/Reader/TypeNode.js +410 -1545
  32. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +78 -51
  33. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +116 -71
  34. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +25 -7
  35. package/dist/Glutinum.Converter/Reader/Types.js +296 -16
  36. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +21 -34
  37. package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
  38. package/dist/Glutinum.Converter/Reader/Utils.js +584 -148
  39. package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
  40. package/dist/Glutinum.Converter/Transform.js +2971 -6875
  41. package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
  42. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
  43. package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
  44. package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
  45. package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
  46. package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
  47. package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
  48. package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
  49. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
  50. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
  51. package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
  52. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
  53. package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +356 -0
  54. package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
  55. package/dist/Glutinum.Converter/TypeScript.Extensions.js +193 -211
  56. package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
  57. package/dist/Glutinum.Converter/Utils/String.js +15 -4
  58. package/dist/Program.js +107 -232
  59. package/package.json +4 -3
  60. package/dist/Glutinum.Converter/TypeScript.js +0 -12
  61. package/src/Glutinum.Converter/js/bootstrap.js +0 -123
  62. package/src/Glutinum.Converter/js/host.js +0 -144
  63. package/src/Glutinum.Converter/js/npm.js +0 -137
  64. package/src/Glutinum.Converter/js/resolve.js +0 -402
@@ -1,655 +1,182 @@
1
1
 
2
- import { Union } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
3
- import { union_type, class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
4
- import { Report_readerError_Z19516DCE } from "./Report.js";
5
- import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
6
- import { concat as concat_2, exists as exists_1, head, tail, fold, item as item_5, contains, filter, map as map_1, append as append_1, collect as collect_1, isEmpty, choose, singleton as singleton_1, length, truncate, empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
7
- import { resolvedBaseTypeArguments, tryReadLiteral, declaredName, isFromEsLib, isFromEs5Lib, modulePathForSymbol, knownExternalTypeNames, isExternalToPackages, importedName, readTypeArguments, getFullNameOrEmpty, defaultTypeArguments, identifierText, symbolAtLocation, isTupleType, Type_NumberLiteral_$007CInt$007CFloat$007COther$007C, Type_StringLiteral_$007CString$007COther$007C, entityNameText, mainDeclaration, resolveAlias, $007CHasTypeFlags$007C_$007C, $007CHasSymbolFlags$007C_$007C } from "./Utils.js";
8
- import { GlueThisType, GlueConditionalType, GlueSubstitution_substitute, GlueConstructSignature, GlueFunctionType, GlueTypeReference, GlueReadonly, GlueRecord, GlueUtilityType, GlueInterface, GlueSubstitution_substituteMember, GlueSubstitution_mentionedTypeParameters, GlueTypeLiteral, GlueTypeUnion, GlueLiteral, GlueClassDeclaration, GluePrimitive, GlueType, GlueMethod, GlueMethodSignature, GlueMember, GlueProperty, GlueAccessor } from "../GlueAST.js";
9
- import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
10
- import { sortByDescending, contains as contains_1, filter as filter_1, choose as choose_1, ofList as ofList_1, exists, map, concat as concat_1, forAll, tryHead, tryFindIndex, collect, empty as empty_1, singleton, append, delay, toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
11
- import { item as item_4 } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
12
- import { unwrap, orElse, value as value_8, defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
13
- import { structuralHash, disposeSafe, comparePrimitives, stringHash, safeHash, equals, Exception } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
14
- import { List_distinctBy, List_distinct, distinct } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
15
- import { FSharpMap__get_IsEmpty, FSharpMap__ContainsKey, ofList } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
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";
16
9
  import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
17
10
  import { sanitizeTypeName } from "../Utils/Naming.js";
18
- import { readTypeQueryNode } from "./TypeQueryNode.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";
19
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";
20
22
  import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
21
23
 
22
- class IntersectionTypePropertyResult extends Union {
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 readPropertyWithoutDeclaration(reader, contextNode, property) {
39
- let matchValue_1;
40
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeOfSymbol(property);
41
- const flags = 1 | 16384;
42
- const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, flags);
43
- if (matchValue == null) {
44
- 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", 56);
45
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
46
- void (objectArg.push(item));
47
- return undefined;
48
- }
49
- else {
50
- const typeNode = matchValue;
51
- const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
52
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
53
- let propertyType;
54
- try {
55
- propertyType = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
56
- }
57
- finally {
58
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
59
- }
60
- 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)]);
61
- }
62
- }
63
-
64
- function readInstantiatedMember(reader, contextNode, property, declaration) {
24
+ function readTypeReference(reader, typeNode) {
25
+ let option_13, symbol_4;
65
26
  const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
66
- const instantiatedType = checker.getTypeOfSymbol(property);
67
- const isInstantiated = !Operators_IsNull(declaration.symbol) && !(instantiatedType === checker.getTypeOfSymbol(declaration.symbol));
68
- const declaredMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration);
69
- if (!isInstantiated) {
70
- return declaredMember;
71
- }
72
- else {
73
- const flags = 1 | 16384;
74
- const enclosingDeclaration = (contextNode.pos < 0) ? undefined : contextNode;
75
- const matchValue = checker.typeToTypeNode(instantiatedType, enclosingDeclaration, flags);
76
- if (matchValue != null) {
77
- const typeNode = matchValue;
78
- const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
79
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
80
- let instantiatedMember;
81
- try {
82
- instantiatedMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
83
- }
84
- finally {
85
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
86
- }
87
- let matchResult, info, typ, functionType, info_1, functionType_1, info_2, declaredMember_1;
88
- switch (declaredMember.tag) {
89
- case 1: {
90
- matchResult = 0;
91
- info = declaredMember.fields[0];
92
- typ = instantiatedMember;
93
- break;
94
- }
95
- case 6: {
96
- if (instantiatedMember.tag === 15) {
97
- matchResult = 1;
98
- functionType = instantiatedMember.fields[0];
99
- info_1 = declaredMember.fields[0];
100
- }
101
- else {
102
- matchResult = 3;
103
- declaredMember_1 = declaredMember;
104
- }
105
- break;
106
- }
107
- case 0: {
108
- if (instantiatedMember.tag === 15) {
109
- matchResult = 2;
110
- functionType_1 = instantiatedMember.fields[0];
111
- info_2 = declaredMember.fields[0];
112
- }
113
- else {
114
- matchResult = 3;
115
- declaredMember_1 = declaredMember;
116
- }
117
- break;
118
- }
119
- default: {
120
- matchResult = 3;
121
- declaredMember_1 = declaredMember;
122
- }
123
- }
124
- switch (matchResult) {
125
- case 0:
126
- return new GlueMember(/* Property */ 1, [new GlueProperty(info.Name, info.Documentation, typ, info.IsStatic, info.IsOptional, info.Accessor, info.IsPrivate)]);
127
- case 1:
128
- return new GlueMember(/* MethodSignature */ 6, [new GlueMethodSignature(info_1.Name, info_1.Documentation, info_1.TypeParameters, functionType.Parameters, functionType.Type)]);
129
- case 2:
130
- 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)]);
131
- default:
132
- return declaredMember_1;
133
- }
27
+ const typeReferenceNode = typeNode;
28
+ const symbolOpt = symbolAtLocation(checker, typeReferenceNode.typeName);
29
+ const readTypeReference_1 = (isStandardLibrary) => {
30
+ let symbol_2, matchValue_3, declarations, typNode, option_9, valueDeclaration, matchValue_5, matchValue_6;
31
+ if ((symbolOpt == null) ? false : ((symbol_2 = symbolOpt, (matchValue_3 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_3) != null)))) {
32
+ return new GlueType(/* TypeParameter */ 16, [value_2(symbolOpt).name]);
134
33
  }
135
34
  else {
136
- return declaredMember;
137
- }
138
- }
139
- }
140
-
141
- const intersectionsInProgress = [];
142
-
143
- function isLibraryName(reader, name) {
144
- const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
145
- if (matchValue == null) {
146
- return false;
147
- }
148
- else {
149
- return matchValue.IsLibraryName(name);
150
- }
151
- }
152
-
153
- function isDeferredConditional(typ) {
154
- const matchValue = typ.flags;
155
- if ($007CHasTypeFlags$007C_$007C(16777216, matchValue) != null) {
156
- return true;
157
- }
158
- else {
159
- return false;
160
- }
161
- }
162
-
163
- function inferTypeNodes(node) {
164
- return toList(delay(() => append((node.kind === 195) ? singleton(node) : empty_1(), delay(() => collect(inferTypeNodes, node.getChildren())))));
165
- }
166
-
167
- function inferredConstraint(reader, inferTypeNode) {
168
- const matchValue_1 = inferTypeNode.typeParameter.constraint;
169
- if (matchValue_1 == null) {
170
- let atPosition;
171
- if (inferTypeNode.parent.kind === 183) {
172
- const typeReferenceNode = inferTypeNode.parent;
173
- let position;
174
- const option_1 = typeReferenceNode.typeArguments;
175
- position = ((option_1 != null) ? tryFindIndex((typeArgument) => (typeArgument === inferTypeNode), option_1) : undefined);
176
- let option_13;
177
- let option_9;
35
+ let matchValue_4;
178
36
  let option_7;
179
- let option_5;
180
- const option_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
181
- let binder_2;
182
- const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
183
- binder_2 = ((symbol) => resolveAlias(checker, symbol));
184
- const option_3 = option_2;
185
- option_5 = ((option_3 != null) ? binder_2(option_3) : undefined);
37
+ const option_5 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
186
38
  if (option_5 != null) {
187
- const symbol_1 = option_5;
188
- option_7 = symbol_1.declarations;
189
- }
190
- else {
191
- option_7 = undefined;
192
- }
193
- option_9 = ((option_7 != null) ? tryHead(option_7) : undefined);
194
- if (option_9 != null) {
195
- const declaration = option_9;
196
- const matchValue = declaration.kind;
197
- option_13 = ((matchValue === 263) ? declaration.typeParameters : ((matchValue === 264) ? declaration.typeParameters : ((matchValue === 265) ? declaration.typeParameters : undefined)));
39
+ option_7 = option_5;
198
40
  }
199
41
  else {
200
- option_13 = undefined;
201
- }
202
- if (option_13 != null) {
203
- const typeParameters = option_13;
204
- const option_11 = position;
205
- if (option_11 != null) {
206
- const position_1 = option_11 | 0;
207
- atPosition = ((position_1 < typeParameters.length) ? item_4(position_1, typeParameters).constraint : undefined);
42
+ let isConditionalAlias;
43
+ let matchValue;
44
+ const option_1 = symbolOpt;
45
+ matchValue = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
46
+ if (matchValue == null) {
47
+ isConditionalAlias = false;
208
48
  }
209
49
  else {
210
- atPosition = undefined;
211
- }
212
- }
213
- else {
214
- atPosition = undefined;
215
- }
216
- }
217
- else {
218
- atPosition = undefined;
219
- }
220
- if (atPosition == null) {
221
- return GlueType.Unknown;
222
- }
223
- else {
224
- const constraintNode_1 = atPosition;
225
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode_1);
226
- }
227
- }
228
- else {
229
- const constraintNode = matchValue_1;
230
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode);
231
- }
232
- }
233
-
234
- function truncateToDeclaredArity(reader, symbolOpt, typeArguments) {
235
- let option_5, _arg;
236
- let declaredArity;
237
- let option_8;
238
- let option_2;
239
- let binder;
240
- const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
241
- binder = ((symbol) => resolveAlias(checker, symbol));
242
- const option_1 = symbolOpt;
243
- option_2 = ((option_1 != null) ? binder(option_1) : undefined);
244
- let binder_2;
245
- const packageContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
246
- binder_2 = ((symbol_1) => mainDeclaration(packageContext, symbol_1));
247
- const option_3 = option_2;
248
- option_8 = ((option_3 != null) ? binder_2(option_3) : undefined);
249
- if (option_8 != null) {
250
- const declaration = option_8;
251
- const matchValue = declaration.kind;
252
- switch (matchValue) {
253
- case 263:
254
- case 264:
255
- case 265: {
256
- declaredArity = defaultArg((option_5 = declaration.typeParameters, (option_5 != null) ? ((_arg = option_5, _arg.length)) : undefined), 0);
257
- break;
258
- }
259
- default:
260
- declaredArity = undefined;
261
- }
262
- }
263
- else {
264
- declaredArity = undefined;
265
- }
266
- let matchResult, arity_1;
267
- if (declaredArity != null) {
268
- if (declaredArity < length(typeArguments)) {
269
- matchResult = 0;
270
- arity_1 = declaredArity;
271
- }
272
- else {
273
- matchResult = 1;
274
- }
275
- }
276
- else {
277
- matchResult = 1;
278
- }
279
- switch (matchResult) {
280
- case 0:
281
- return truncate(arity_1, typeArguments);
282
- default:
283
- return typeArguments;
284
- }
285
- }
286
-
287
- function isGlobalThisQuery(typeNode) {
288
- if (typeNode.kind === 186) {
289
- return entityNameText(typeNode.exprName) === "globalThis";
290
- }
291
- else {
292
- return false;
293
- }
294
- }
295
-
296
- function readTypeUsingFlags(reader, typ) {
297
- let declarations;
298
- const matchValue = typ.flags;
299
- let matchResult;
300
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
301
- if (Operators_IsNull(typ.symbol)) {
302
- matchResult = 0;
303
- }
304
- else {
305
- matchResult = 1;
306
- }
307
- }
308
- else {
309
- matchResult = 1;
310
- }
311
- switch (matchResult) {
312
- case 0:
313
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
314
- default:
315
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
316
- const matchValue_1 = typ.symbol.declarations;
317
- if (matchValue_1 == null) {
318
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
319
- }
320
- else if ((declarations = matchValue_1, declarations.length > 0)) {
321
- const declarations_1 = matchValue_1;
322
- const declaration = item_4(0, declarations_1);
323
- const matchValue_2 = declaration.kind;
324
- switch (matchValue_2) {
325
- case 263:
326
- 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)]);
327
- case 264:
328
- case 265: {
329
- const flags = 1 | 16384;
330
- const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, flags);
331
- if (matchValue_3 == null) {
332
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration);
333
- }
334
- else {
335
- const typeNode = matchValue_3;
336
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
337
- }
50
+ const symbol_1 = matchValue;
51
+ const matchValue_1 = symbol_1.declarations;
52
+ let matchResult, declarations_1;
53
+ if (matchValue_1 != null) {
54
+ if ((declarations = matchValue_1, declarations.length > 0)) {
55
+ matchResult = 0;
56
+ declarations_1 = matchValue_1;
57
+ }
58
+ else {
59
+ matchResult = 1;
338
60
  }
339
- case 267:
340
- return GlueType.Discard;
341
- default:
342
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration);
343
61
  }
344
- }
345
- else {
346
- throw new Exception("Match failure: Microsoft.FSharp.Core.FSharpOption`1");
347
- }
348
- }
349
- else if ($007CHasTypeFlags$007C_$007C(4, matchValue) != null) {
350
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
351
- }
352
- else if ($007CHasTypeFlags$007C_$007C(8, matchValue) != null) {
353
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
354
- }
355
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue) != null) {
356
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
357
- }
358
- else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
359
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
360
- }
361
- else if ($007CHasTypeFlags$007C_$007C(16384, matchValue) != null) {
362
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
363
- }
364
- else {
365
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
366
- }
367
- }
368
- }
369
-
370
- export function UtilityType_readExclude(reader, typeReferenceNode) {
371
- 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;
372
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
373
- const matchValue = typ.flags;
374
- let matchResult;
375
- if ($007CHasTypeFlags$007C_$007C(128, matchValue) != null) {
376
- matchResult = 0;
377
- }
378
- else if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
379
- matchResult = 0;
380
- }
381
- else if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
382
- matchResult = 0;
383
- }
384
- else {
385
- matchResult = 1;
386
- }
387
- switch (matchResult) {
388
- case 0:
389
- return new GlueType(/* Union */ 7, [new GlueTypeUnion((matchValue_1 = typ.flags, ($007CHasTypeFlags$007C_$007C(128, 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", 295), (objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg.push(item)))), empty())) : singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_4.fields[0]])])))) : (($007CHasTypeFlags$007C_$007C(256, matchValue_1) != null) ? ((activePatternResult_6 = Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(typ), (activePatternResult_6.tag === 1) ? singleton_1(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", 310), (objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_1.push(item_1)))), empty())) : singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* Int */ 1, [activePatternResult_6.fields[0]])]))))) : choose((typ_1) => {
390
- const matchValue_2 = typ_1.flags;
391
- if ($007CHasTypeFlags$007C_$007C(128, matchValue_2) != null) {
392
- const literalType = typ_1;
393
- return new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [literalType.value])]);
394
- }
395
- else if ($007CHasTypeFlags$007C_$007C(256, matchValue_2) != null) {
396
- const activePatternResult_9 = Type_NumberLiteral_$007CInt$007CFloat$007COther$007C(typ_1);
397
- switch (activePatternResult_9.tag) {
398
- case 1:
399
- return new GlueType(/* Literal */ 8, [new GlueLiteral(/* Float */ 2, [activePatternResult_9.fields[0]])]);
400
- case 2: {
401
- const item_2 = Report_readerError_Z19516DCE("Exclude", "Expected a number literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 337);
402
- const objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
403
- void (objectArg_2.push(item_2));
404
- return undefined;
62
+ else {
63
+ matchResult = 1;
64
+ }
65
+ switch (matchResult) {
66
+ case 0: {
67
+ const declaration = item_1(0, declarations_1);
68
+ isConditionalAlias = ((declaration.kind === 266) && (declaration.type.kind === 195));
69
+ break;
405
70
  }
406
71
  default:
407
- return new GlueType(/* Literal */ 8, [new GlueLiteral(/* Int */ 1, [activePatternResult_9.fields[0]])]);
72
+ isConditionalAlias = false;
408
73
  }
409
74
  }
410
- else {
411
- return undefined;
75
+ if ((typeReferenceNode.pos < 0) ? true : !isConditionalAlias) {
76
+ option_7 = undefined;
412
77
  }
413
- }, toList(typ.types)))))]);
414
- default: {
415
- let matchResult_1;
416
- if ($007CHasTypeFlags$007C_$007C(16777216, matchValue) != null) {
417
- if ((matchValue_3 = typeReferenceNode.typeArguments, (matchValue_3 != null) && (((typeArguments = matchValue_3, typeArguments.length > 1)) && ((typeArguments_1 = matchValue_3, (excluded = item_4(0, typeArguments_1), (isNullish = ((typeNode) => {
418
- const matchValue_4 = typeNode.kind;
419
- switch (matchValue_4) {
420
- case 157:
421
- return true;
422
- case 192:
423
- return forAll(isNullish, typeNode.types);
424
- case 201:
425
- return typeNode.literal.kind === 106;
426
- default:
427
- return false;
78
+ else {
79
+ const typ = checker.getTypeFromTypeNode(typeReferenceNode);
80
+ let isUnknown;
81
+ const matchValue_2 = typ.flags;
82
+ let matchResult_1;
83
+ if ($007CHasTypeFlags$007C_$007C(1, matchValue_2) != null) {
84
+ matchResult_1 = 0;
428
85
  }
429
- }), (isNullish(item_4(1, typeArguments_1)) ? true : (excluded.kind === 199)) ? true : ((excluded.kind === 183) && ((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))))))))))))) {
430
- matchResult_1 = 0;
431
- }
432
- else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
433
- if ((matchValue_7 = typeReferenceNode.typeArguments, (matchValue_7 != null) && (((typeArguments_2 = matchValue_7, typeArguments_2.length > 1)) && ((typeArguments_3 = matchValue_7, (excluded_1 = item_4(0, typeArguments_3), (isNullish_1 = ((typeNode_1) => {
434
- const matchValue_8 = typeNode_1.kind;
435
- switch (matchValue_8) {
436
- case 157:
437
- return true;
438
- case 192:
439
- return forAll(isNullish_1, typeNode_1.types);
440
- case 201:
441
- return typeNode_1.literal.kind === 106;
442
- default:
443
- return false;
444
- }
445
- }), (isNullish_1(item_4(1, typeArguments_3)) ? true : (excluded_1.kind === 199)) ? true : ((excluded_1.kind === 183) && ((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))))))))))))) {
86
+ else if ($007CHasTypeFlags$007C_$007C(262144, matchValue_2) != null) {
446
87
  matchResult_1 = 0;
447
88
  }
448
89
  else {
449
90
  matchResult_1 = 1;
450
91
  }
451
- }
452
- else {
453
- matchResult_1 = 1;
454
- }
455
- }
456
- else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
457
- if ((matchValue_11 = typeReferenceNode.typeArguments, (matchValue_11 != null) && (((typeArguments_4 = matchValue_11, typeArguments_4.length > 1)) && ((typeArguments_5 = matchValue_11, (excluded_2 = item_4(0, typeArguments_5), (isNullish_2 = ((typeNode_2) => {
458
- const matchValue_12 = typeNode_2.kind;
459
- switch (matchValue_12) {
460
- case 157:
461
- return true;
462
- case 192:
463
- return forAll(isNullish_2, typeNode_2.types);
464
- case 201:
465
- return typeNode_2.literal.kind === 106;
92
+ switch (matchResult_1) {
93
+ case 0: {
94
+ isUnknown = true;
95
+ break;
96
+ }
466
97
  default:
467
- return false;
468
- }
469
- }), (isNullish_2(item_4(1, typeArguments_5)) ? true : (excluded_2.kind === 199)) ? true : ((excluded_2.kind === 183) && ((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))))))))))))) {
470
- matchResult_1 = 0;
471
- }
472
- else {
473
- matchResult_1 = 1;
474
- }
475
- }
476
- else {
477
- matchResult_1 = 1;
478
- }
479
- switch (matchResult_1) {
480
- case 0:
481
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](item_4(0, value_8(typeReferenceNode.typeArguments)));
482
- default:
483
- if ($007CHasTypeFlags$007C_$007C(4, matchValue) != null) {
484
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
485
- }
486
- else if ($007CHasTypeFlags$007C_$007C(8, matchValue) != null) {
487
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
98
+ isUnknown = false;
488
99
  }
489
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue) != null) {
490
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
100
+ if (isDeferredConditional(typ) ? true : isUnknown) {
101
+ option_7 = undefined;
491
102
  }
492
103
  else {
493
- 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", 391);
494
- const objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
495
- void (objectArg_3.push(item_3));
496
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
104
+ const option_3 = checker.typeToTypeNode(typ, typeReferenceNode, typeNodeBuilderFlags);
105
+ option_7 = ((option_3 != null) ? ((typNode = option_3, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode))) : undefined);
497
106
  }
498
- }
499
- }
500
- }
501
- }
502
-
503
- function UtilityType_readMembers(reader, contextNode, typ) {
504
- let objectArg;
505
- return toList(distinct(concat_1(choose((property) => {
506
- const matchValue = property.declarations;
507
- if (matchValue == null) {
508
- const option_1 = readPropertyWithoutDeclaration(reader, contextNode, property);
509
- if (option_1 != null) {
510
- return singleton(option_1);
511
- }
512
- else {
513
- return undefined;
514
- }
515
- }
516
- else {
517
- return map((declaration) => readInstantiatedMember(reader, contextNode, property, declaration), matchValue);
518
- }
519
- }, toList((objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg.getPropertiesOfType(typ))))), {
520
- Equals: equals,
521
- GetHashCode: (x) => (safeHash(x) | 0),
522
- }));
523
- }
524
-
525
- const UtilityType_expansionsInProgress = [];
526
-
527
- export function UtilityType_tryExpandAnonymousObjectApplication(reader, typeReferenceNode) {
528
- let matchValue, typeArguments, typNode;
529
- if (!((matchValue = typeReferenceNode.typeArguments, (matchValue == null) ? false : ((typeArguments = matchValue, typeArguments.length > 0))))) {
530
- return undefined;
531
- }
532
- else {
533
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
534
- let isNamedDeclaration;
535
- if (Operators_IsNull(typ.symbol)) {
536
- isNamedDeclaration = false;
537
- }
538
- else {
539
- const matchValue_1 = typ.symbol.declarations;
540
- isNamedDeclaration = ((matchValue_1 == null) ? false : exists((declaration) => {
541
- const matchValue_2 = declaration.kind;
542
- switch (matchValue_2) {
543
- case 263:
544
- case 264:
545
- return true;
546
- default:
547
- return false;
548
107
  }
549
- }, matchValue_1));
550
- }
551
- let isTypeAliasApplication;
552
- const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
553
- if (matchValue_3 == null) {
554
- isTypeAliasApplication = false;
555
- }
556
- else {
557
- const symbol = matchValue_3;
558
- const matchValue_4 = symbol.flags;
559
- isTypeAliasApplication = ($007CHasSymbolFlags$007C_$007C(524288, matchValue_4) != null);
560
- }
561
- const isInProgress = exists((inProgress) => (inProgress === typ), UtilityType_expansionsInProgress);
562
- let isGenericMapped;
563
- const matchValue_5 = typ.flags;
564
- isGenericMapped = (($007CHasTypeFlags$007C_$007C(524288, matchValue_5) != null) && (((typ.objectFlags & 32) !== 0) && exists((argument) => {
565
- const matchValue_6 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(argument).flags;
566
- if ($007CHasTypeFlags$007C_$007C(262144, matchValue_6) != null) {
567
- return true;
568
108
  }
569
- else {
570
- return false;
571
- }
572
- }, value_8(typeReferenceNode.typeArguments))));
573
- const isArrayLike = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().isArrayLikeType(typ);
574
- const matchValue_7 = typ.flags;
575
- let matchResult;
576
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue_7) != null) {
577
- if ((isTupleType(typ) ? true : (isArrayLike && !isNamedDeclaration)) && !isInProgress) {
578
- matchResult = 0;
579
- }
580
- else {
581
- matchResult = 1;
582
- }
583
- }
584
- else {
585
- matchResult = 1;
586
- }
587
- switch (matchResult) {
588
- case 0: {
589
- const flags = 1 | 16384;
590
- const option_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, flags);
591
- if (option_1 != null) {
592
- return (typNode = option_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode));
109
+ matchValue_4 = ((option_7 != null) ? option_7 : tryResolveDeferred(reader, typeNode));
110
+ if (matchValue_4 == null) {
111
+ const isQualified = typeReferenceNode.typeName.kind === 167;
112
+ const writtenName = () => {
113
+ if (isQualified) {
114
+ return typeReferenceNode.typeName.right.text;
115
+ }
116
+ else {
117
+ return identifierText(typeReferenceNode.typeName);
118
+ }
119
+ };
120
+ let name;
121
+ if (symbolOpt == null) {
122
+ name = writtenName();
593
123
  }
594
124
  else {
595
- return undefined;
125
+ const symbol_3 = symbolOpt;
126
+ 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());
596
127
  }
597
- }
598
- default: {
599
- let matchResult_1;
600
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue_7) != null) {
601
- if ((!isNamedDeclaration && !isInProgress) && !isGenericMapped) {
602
- matchResult_1 = 0;
128
+ const isUnresolved = ((reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && (symbolOpt == null)) && (typeReferenceNode.pos >= 0);
129
+ const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
130
+ if ((((name === "...") ? true : ((matchValue_6 = typeReferenceNode.typeArguments, (matchValue_6 == null) ? false : exists((typeArgument) => {
131
+ if (typeArgument.kind === 184) {
132
+ return typeArgument.typeName.escapedText === "...";
603
133
  }
604
134
  else {
605
- matchResult_1 = 1;
135
+ return false;
606
136
  }
137
+ }, matchValue_6)))) ? true : isUnresolved) ? true : (isExternal && !FSharpSet__Contains(knownExternalTypeNames, name))) {
138
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
607
139
  }
608
140
  else {
609
- matchResult_1 = 1;
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))]);
610
142
  }
611
- switch (matchResult_1) {
612
- case 0: {
613
- void (UtilityType_expansionsInProgress.push(typ));
614
- let members;
615
- try {
616
- members = UtilityType_readMembers(reader, typeReferenceNode, typ);
617
- }
618
- finally {
619
- UtilityType_expansionsInProgress.splice(UtilityType_expansionsInProgress.length - 1, 1);
620
- }
621
- if (isEmpty(members)) {
143
+ }
144
+ else {
145
+ return matchValue_4;
146
+ }
147
+ }
148
+ };
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))) {
150
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_2(typeReferenceNode.typeArguments)[0]);
151
+ }
152
+ else if (isFromEs5Lib(symbolOpt)) {
153
+ const matchValue_10 = getFullNameOrEmpty(checker, typeReferenceNode.typeName);
154
+ switch (matchValue_10) {
155
+ case "Exclude":
156
+ return readExclude(reader, typeReferenceNode);
157
+ case "Uppercase":
158
+ case "Lowercase":
159
+ case "Capitalize":
160
+ case "Uncapitalize": {
161
+ const literals = (typ_1) => {
162
+ const matchValue_7 = typ_1.flags;
163
+ if ($007CHasTypeFlags$007C_$007C(1024, matchValue_7) != null) {
164
+ const activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ_1);
165
+ if (activePatternResult_4.tag === 1) {
622
166
  return undefined;
623
167
  }
624
168
  else {
625
- return new GlueType(/* TypeLiteral */ 21, [new GlueTypeLiteral(members)]);
169
+ return singleton(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_4.fields[0]])]));
626
170
  }
627
171
  }
628
- default: {
629
- let matchResult_2;
630
- if ($007CHasTypeFlags$007C_$007C(4, matchValue_7) != null) {
631
- if (isTypeAliasApplication) {
632
- matchResult_2 = 0;
633
- }
634
- else if ($007CHasTypeFlags$007C_$007C(8, matchValue_7) != null) {
635
- if (isTypeAliasApplication) {
636
- matchResult_2 = 0;
637
- }
638
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue_7) != null) {
639
- if (isTypeAliasApplication) {
640
- matchResult_2 = 0;
641
- }
642
- else {
643
- matchResult_2 = 1;
644
- }
645
- }
646
- else {
647
- matchResult_2 = 1;
648
- }
649
- }
650
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue_7) != null) {
651
- if (isTypeAliasApplication) {
172
+ else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_7) != null) {
173
+ return fold((acc, cases) => {
174
+ let matchResult_2, acc_1, cases_1;
175
+ if (acc != null) {
176
+ if (cases != null) {
652
177
  matchResult_2 = 0;
178
+ acc_1 = acc;
179
+ cases_1 = cases;
653
180
  }
654
181
  else {
655
182
  matchResult_2 = 1;
@@ -658,453 +185,234 @@ export function UtilityType_tryExpandAnonymousObjectApplication(reader, typeRefe
658
185
  else {
659
186
  matchResult_2 = 1;
660
187
  }
661
- }
662
- else if ($007CHasTypeFlags$007C_$007C(8, matchValue_7) != null) {
663
- if (isTypeAliasApplication) {
664
- matchResult_2 = 0;
665
- }
666
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue_7) != null) {
667
- if (isTypeAliasApplication) {
668
- matchResult_2 = 0;
669
- }
670
- else {
671
- matchResult_2 = 1;
672
- }
673
- }
674
- else {
675
- matchResult_2 = 1;
188
+ switch (matchResult_2) {
189
+ case 0:
190
+ return append(acc_1, cases_1);
191
+ default:
192
+ return undefined;
676
193
  }
677
- }
678
- else if ($007CHasTypeFlags$007C_$007C(16, matchValue_7) != null) {
679
- if (isTypeAliasApplication) {
680
- matchResult_2 = 0;
194
+ }, empty(), map(literals, toList(typ_1.types)));
195
+ }
196
+ else {
197
+ return undefined;
198
+ }
199
+ };
200
+ if (typeReferenceNode.pos < 0) {
201
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
202
+ }
203
+ else {
204
+ const matchValue_9 = literals(checker.getTypeFromTypeNode(typeReferenceNode));
205
+ let matchResult_3, single, cases_2;
206
+ if (matchValue_9 != null) {
207
+ if (!isEmpty(matchValue_9)) {
208
+ if (isEmpty(tail(matchValue_9))) {
209
+ matchResult_3 = 0;
210
+ single = head(matchValue_9);
681
211
  }
682
212
  else {
683
- matchResult_2 = 1;
213
+ matchResult_3 = 1;
214
+ cases_2 = matchValue_9;
684
215
  }
685
216
  }
686
217
  else {
687
- matchResult_2 = 1;
688
- }
689
- switch (matchResult_2) {
690
- case 0:
691
- return readTypeUsingFlags(reader, typ);
692
- default:
693
- return undefined;
218
+ matchResult_3 = 2;
694
219
  }
695
220
  }
221
+ else {
222
+ matchResult_3 = 2;
223
+ }
224
+ switch (matchResult_3) {
225
+ case 0:
226
+ return single;
227
+ case 1:
228
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(cases_2)]);
229
+ default:
230
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
231
+ }
696
232
  }
697
233
  }
698
- }
699
- }
700
- }
701
-
702
- const UtilityType_partialsBeingRead = [];
703
-
704
- function UtilityType_baseTypeOf(reader, typeNode) {
705
- let option_2, option, binder, checker, option_1, mapping, objectArg, option_3;
706
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeNode);
707
- const matchValue = typ.flags;
708
- let matchResult;
709
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
710
- if ((typeNode.pos < 0) && (typeNode.kind === 183)) {
711
- matchResult = 0;
712
- }
713
- else {
714
- matchResult = 1;
715
- }
716
- }
717
- else {
718
- matchResult = 1;
719
- }
720
- switch (matchResult) {
721
- case 0:
722
- 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);
723
- default:
724
- return typ;
725
- }
726
- }
727
-
728
- function UtilityType_literalKeysOf(typeNode_mut) {
729
- UtilityType_literalKeysOf:
730
- while (true) {
731
- const typeNode = typeNode_mut;
732
- const matchValue = typeNode.kind;
733
- switch (matchValue) {
734
- case 192:
735
- return collect_1(UtilityType_literalKeysOf, toList(typeNode.types));
736
- case 196: {
737
- typeNode_mut = typeNode.type;
738
- continue UtilityType_literalKeysOf;
739
- }
740
- case 201: {
741
- const literal = typeNode.literal;
742
- if (literal.kind === 11) {
743
- return singleton_1(literal.text);
234
+ case "Partial":
235
+ return readPartial(reader, typeReferenceNode);
236
+ case "Record":
237
+ return readRecord(reader, typeReferenceNode);
238
+ case "ReturnType":
239
+ return readReturnType(reader, typeReferenceNode);
240
+ case "ThisParameterType":
241
+ return readThisParameterType(reader, typeReferenceNode);
242
+ case "Omit": {
243
+ const option_16 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
244
+ if (option_16 != null) {
245
+ return option_16;
744
246
  }
745
247
  else {
746
- return empty();
248
+ return readOmit(reader, typeReferenceNode);
747
249
  }
748
250
  }
749
- default:
750
- return empty();
751
- }
752
- break;
753
- }
754
- }
755
-
756
- function UtilityType_withoutForeignTypeParameters(reader, bound, members) {
757
- const declaredAbove = (node) => {
758
- if (Operators_IsNull(node)) {
759
- return empty();
760
- }
761
- else {
762
- const typeParameters = node.typeParameters;
763
- return append_1((typeParameters == null) ? empty() : map_1((p) => identifierText(p.name), toList(typeParameters)), declaredAbove(node.parent));
764
- }
765
- };
766
- let inScope;
767
- const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
768
- inScope = ((matchValue == null) ? empty() : declaredAbove(matchValue));
769
- const foreign = ofList(map_1((name_1) => [name_1, new GlueType(/* Primitive */ 3, [GluePrimitive.Any])], filter((name) => {
770
- if (!contains(name, inScope, {
771
- Equals: (x_1, y_1) => (x_1 === y_1),
772
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
773
- })) {
774
- return !FSharpMap__ContainsKey(bound, name);
775
- }
776
- else {
777
- return false;
778
- }
779
- }, List_distinct(collect_1((glueMember) => {
780
- switch (glueMember.tag) {
781
- case 1:
782
- return GlueSubstitution_mentionedTypeParameters(glueMember.fields[0].Type);
783
- case 0: {
784
- const method = glueMember.fields[0];
785
- return append_1(GlueSubstitution_mentionedTypeParameters(method.Type), collect_1((parameter) => GlueSubstitution_mentionedTypeParameters(parameter.Type), method.Parameters));
786
- }
787
- case 6: {
788
- const method_1 = glueMember.fields[0];
789
- return append_1(GlueSubstitution_mentionedTypeParameters(method_1.Type), collect_1((parameter_1) => GlueSubstitution_mentionedTypeParameters(parameter_1.Type), method_1.Parameters));
251
+ case "Pick": {
252
+ const option_18 = tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
253
+ if (option_18 != null) {
254
+ return option_18;
255
+ }
256
+ else {
257
+ return readPick(reader, typeReferenceNode);
258
+ }
790
259
  }
260
+ case "Readonly":
261
+ return readReadonly(reader, typeReferenceNode);
791
262
  default:
792
- return empty();
263
+ return readTypeReference_1(true);
793
264
  }
794
- }, members), {
795
- Equals: (x, y) => (x === y),
796
- GetHashCode: (x) => (stringHash(x) | 0),
797
- }))), {
798
- Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
799
- });
800
- if (FSharpMap__get_IsEmpty(foreign)) {
801
- return members;
802
265
  }
803
266
  else {
804
- return map_1((glueMember_1) => GlueSubstitution_substituteMember(foreign, glueMember_1), members);
267
+ return readTypeReference_1(isFromEsLib(symbolOpt));
805
268
  }
806
269
  }
807
270
 
808
- export function UtilityType_readPartial(reader, typeReferenceNode) {
809
- const baseType = UtilityType_baseTypeOf(reader, item_4(0, value_8(typeReferenceNode.typeArguments)));
810
- if (exists((typ) => (typ === baseType), UtilityType_partialsBeingRead)) {
811
- const item = Report_readerError_Z19516DCE("Partial", "Recursive Partial is not supported, defaulting to obj", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 626);
812
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
813
- void (objectArg.push(item));
814
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
815
- }
816
- else {
817
- void (UtilityType_partialsBeingRead.push(baseType));
818
- try {
819
- if (isTupleType(baseType)) {
820
- const flags = 1 | 16384;
821
- const typNode = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode), undefined, flags);
822
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
271
+ function readFunctionType(reader, typeNode) {
272
+ let matchValue_1;
273
+ const functionTypeNode = typeNode;
274
+ let typeParameters;
275
+ const collectEnclosing = (node_mut, acc_mut) => {
276
+ collectEnclosing:
277
+ while (true) {
278
+ const node = node_mut, acc = acc_mut;
279
+ if (Operators_IsNull(node)) {
280
+ return acc;
281
+ }
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"]());
284
+ acc_mut = acc;
285
+ continue collectEnclosing;
286
+ }
287
+ else if (node.kind === 169) {
288
+ return empty();
823
289
  }
824
290
  else {
825
- const baseNode = item_4(0, value_8(typeReferenceNode.typeArguments));
826
- let members;
827
- const matchValue = baseType.flags;
828
- let matchResult;
829
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
830
- if (baseNode.kind === 133) {
831
- matchResult = 0;
832
- }
833
- else {
834
- matchResult = 1;
835
- }
836
- }
837
- else {
838
- matchResult = 1;
839
- }
840
- switch (matchResult) {
841
- case 0: {
842
- members = empty();
843
- break;
844
- }
845
- default: {
846
- let matchResult_1;
847
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
848
- if ((baseNode.pos < 0) && (baseNode.kind === 187)) {
849
- matchResult_1 = 0;
850
- }
851
- else {
852
- matchResult_1 = 1;
853
- }
854
- }
855
- else {
856
- matchResult_1 = 1;
857
- }
858
- switch (matchResult_1) {
859
- case 0: {
860
- const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](baseNode);
861
- members = ((matchValue_1.tag === 21) ? matchValue_1.fields[0].Members : empty());
862
- break;
863
- }
864
- default:
865
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
866
- 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", 669);
867
- const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
868
- void (objectArg_1.push(item_1));
869
- members = empty();
870
- }
871
- else {
872
- members = UtilityType_readMembers(reader, typeReferenceNode, baseType);
873
- }
874
- }
875
- }
876
- }
877
- const defaults = defaultTypeArguments(reader, item_4(0, value_8(typeReferenceNode.typeArguments)));
878
- let members_2;
879
- const members_1 = map_1((glueMember) => GlueSubstitution_substituteMember(defaults, glueMember), members);
880
- members_2 = ((typeReferenceNode.pos < 0) ? UtilityType_withoutForeignTypeParameters(reader, defaults, members_1) : members_1);
881
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* Partial */ 0, [new GlueInterface(empty(), getFullNameOrEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), typeReferenceNode), entityNameText(typeReferenceNode.typeName), members_2, empty(), empty())])]);
291
+ const ownTypeParameters = node.typeParameters;
292
+ const acc_1 = (ownTypeParameters == null) ? acc : append(acc, toList(ownTypeParameters));
293
+ node_mut = node.parent;
294
+ acc_mut = acc_1;
295
+ continue collectEnclosing;
882
296
  }
883
- }
884
- finally {
885
- UtilityType_partialsBeingRead.splice(UtilityType_partialsBeingRead.length - 1, 1);
886
- }
887
- }
888
- }
889
-
890
- export function UtilityType_readRecord(reader, typeReferenceNode) {
891
- const typeArguments = readTypeArguments(reader, typeReferenceNode);
892
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* Record */ 1, [new GlueRecord(item_5(0, typeArguments), item_5(1, typeArguments))])]);
893
- }
894
-
895
- export function UtilityType_readReturnType(reader, typeReferenceNode) {
896
- const rawTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
897
- let typ;
898
- const matchValue = rawTyp.flags;
899
- let matchResult;
900
- if ($007CHasTypeFlags$007C_$007C(16777216, matchValue) != null) {
901
- matchResult = 0;
902
- }
903
- else if ($007CHasTypeFlags$007C_$007C(8388608, matchValue) != null) {
904
- matchResult = 0;
905
- }
906
- else if ($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) {
907
- matchResult = 0;
908
- }
909
- else if ($007CHasTypeFlags$007C_$007C(4194304, matchValue) != null) {
910
- matchResult = 0;
911
- }
912
- else {
913
- matchResult = 1;
914
- }
915
- switch (matchResult) {
916
- case 0: {
917
- typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getApparentType(rawTyp);
918
297
  break;
919
298
  }
920
- default:
921
- typ = rawTyp;
922
- }
923
- const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
924
- if (matchValue_1 == null) {
925
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* ReturnType */ 2, [readTypeUsingFlags(reader, typ)])]);
926
- }
927
- else {
928
- const typeNode = matchValue_1;
929
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* ReturnType */ 2, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode)])]);
930
- }
299
+ };
300
+ const matchValue = List_distinctBy((typeParameter) => identifierText(typeParameter.name), collectEnclosing(functionTypeNode, empty()), {
301
+ Equals: (x, y) => (x === y),
302
+ GetHashCode: (x) => (stringHash(x) | 0),
303
+ });
304
+ typeParameters = (isEmpty(matchValue) ? empty() : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"]((ts.factory).createNodeArray(Array.from(matchValue))));
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))]);
931
306
  }
932
307
 
933
- export function UtilityType_readThisParameterType(reader, typeReferenceNode) {
934
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
935
- const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
936
- if (matchValue == null) {
937
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* ThisParameterType */ 3, [readTypeUsingFlags(reader, typ)])]);
308
+ function readImportType(reader, typeNode) {
309
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
310
+ const importTypeNode = typeNode;
311
+ let unresolvedModule;
312
+ if (importTypeNode.pos < 0) {
313
+ unresolvedModule = undefined;
314
+ }
315
+ else if (importTypeNode.argument.kind === 202) {
316
+ const literal = importTypeNode.argument.literal;
317
+ unresolvedModule = ((symbolAtLocation(checker, literal) != null) ? undefined : literal.text);
938
318
  }
939
319
  else {
940
- const typeNode = matchValue;
941
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* ThisParameterType */ 3, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode)])]);
320
+ unresolvedModule = undefined;
942
321
  }
943
- }
944
-
945
- export function UtilityType_readOmit(reader, typeReferenceNode) {
946
- let option_1, matchValue_3, item_1, objectArg_2, objectArg_3, members_3;
947
- let keysToOmitType;
948
- const node = item_4(1, value_8(typeReferenceNode.typeArguments));
949
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
950
- keysToOmitType = objectArg.getTypeFromTypeNode(node);
951
- const tryReadValueOfKeys = (typ) => {
952
- const activePatternResult = Type_StringLiteral_$007CString$007COther$007C(typ);
953
- if (activePatternResult.tag === 1) {
954
- const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 768);
955
- const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
956
- void (objectArg_1.push(item));
957
- return undefined;
958
- }
959
- else {
960
- return activePatternResult.fields[0];
322
+ const matchValue_1 = importTypeNode.qualifier;
323
+ if (unresolvedModule == null) {
324
+ if (matchValue_1 == null) {
325
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
961
326
  }
962
- };
963
- let keysToOmit;
964
- const matchValue = keysToOmitType.flags;
965
- let matchResult;
966
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
967
- if (typeReferenceNode.pos < 0) {
968
- matchResult = 0;
327
+ else if (importTypeNode.isTypeOf) {
328
+ const qualifier_1 = matchValue_1;
329
+ const typNode = (ts.factory).createTypeQueryNode(qualifier_1);
330
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode);
969
331
  }
970
332
  else {
971
- matchResult = 1;
333
+ const qualifier_2 = matchValue_1;
334
+ const typNode_1 = (ts.factory).createTypeReferenceNode(qualifier_2, unwrap(importTypeNode.typeArguments));
335
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_1);
972
336
  }
973
337
  }
974
338
  else {
975
- matchResult = 1;
976
- }
977
- switch (matchResult) {
978
- case 0: {
979
- keysToOmit = ofList_1(UtilityType_literalKeysOf(item_4(1, value_8(typeReferenceNode.typeArguments))));
980
- break;
339
+ const moduleName = unresolvedModule;
340
+ const warning = concat("\'", moduleName, "\' is not installed, the types imported from it are generated as \'obj\'");
341
+ if (!contains(warning, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), {
342
+ Equals: (x, y) => (x === y),
343
+ GetHashCode: (x) => (stringHash(x) | 0),
344
+ })) {
345
+ void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
981
346
  }
982
- default:
983
- keysToOmit = (keysToOmitType.isUnion() ? choose_1(tryReadValueOfKeys, keysToOmitType.types) : defaultArg((option_1 = tryReadValueOfKeys(keysToOmitType), (option_1 != null) ? singleton(option_1) : undefined), []));
347
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
984
348
  }
985
- const baseType = UtilityType_baseTypeOf(reader, item_4(0, value_8(typeReferenceNode.typeArguments)));
986
- let literalMembers;
987
- const matchValue_1 = baseType.flags;
988
- let matchResult_1;
989
- if ($007CHasTypeFlags$007C_$007C(1, matchValue_1) != null) {
990
- if (typeReferenceNode.pos < 0) {
991
- matchResult_1 = 0;
992
- }
993
- else {
994
- matchResult_1 = 1;
349
+ }
350
+
351
+ function readThisType(reader, typeNode) {
352
+ let option_1, arg;
353
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
354
+ const thisTypeNode = typeNode;
355
+ const typ = checker.getTypeAtLocation(thisTypeNode);
356
+ const declarations = Operators_IsNull(typ.symbol) ? undefined : typ.symbol.declarations;
357
+ const typParameters = (declarations == null) ? empty() : defaultArg((option_1 = tryHead(sortByDescending((typeParameters) => (~~typeParameters.length | 0), choose((declaration) => {
358
+ const matchValue = declaration.kind;
359
+ switch (matchValue) {
360
+ case 264:
361
+ case 265: {
362
+ const classDeclaration = declaration;
363
+ return classDeclaration.typeParameters;
364
+ }
365
+ default:
366
+ return undefined;
995
367
  }
368
+ }, declarations), {
369
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
370
+ })), (option_1 != null) ? ((arg = option_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](arg))) : undefined), empty());
371
+ if (Operators_IsNull(typ.symbol)) {
372
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
996
373
  }
997
374
  else {
998
- matchResult_1 = 1;
375
+ return new GlueType(/* ThisType */ 17, [new GlueThisType(defaultArg(declaredName(typ.symbol), typ.symbol.name), typParameters)]);
999
376
  }
1000
- switch (matchResult_1) {
1001
- case 0: {
1002
- const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](item_4(0, value_8(typeReferenceNode.typeArguments)));
1003
- literalMembers = ((matchValue_2.tag === 20) ? matchValue_2.fields[0] : ((matchValue_2.tag === 21) ? matchValue_2.fields[0].Members : undefined));
1004
- break;
377
+ }
378
+
379
+ function readTemplateLiteralType(reader, typeNode) {
380
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
381
+ const templateLiteralTypeNode = typeNode;
382
+ const readResolvedLiterals = (typ_1) => {
383
+ const matchValue = typ_1.flags;
384
+ if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
385
+ const activePatternResult_1 = Type_StringLiteral_$007CString$007COther$007C(typ_1);
386
+ if (activePatternResult_1.tag === 1) {
387
+ return empty();
388
+ }
389
+ else {
390
+ return singleton(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_1.fields[0]])]));
391
+ }
1005
392
  }
1006
- default:
1007
- literalMembers = undefined;
1008
- }
1009
- const members_1 = collect_1((property) => {
1010
- const matchValue_4 = property.declarations;
1011
- if (matchValue_4 == null) {
1012
- throw new Exception(Report_readerError_Z19516DCE("type node", "Missing declarations", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 827));
393
+ else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
394
+ return collect(readResolvedLiterals, toList(typ_1.types));
1013
395
  }
1014
396
  else {
1015
- return map_1((declaration) => readInstantiatedMember(reader, typeReferenceNode, property, declaration), toList(matchValue_4));
1016
- }
1017
- }, toList(filter_1((prop) => !contains_1(prop.name, keysToOmit, {
1018
- Equals: (x, y) => (x === y),
1019
- GetHashCode: (x) => (stringHash(x) | 0),
1020
- }), (matchValue_3 = baseType.flags, ($007CHasTypeFlags$007C_$007C(1, matchValue_3) != null) ? ((literalMembers != null) ? [] : (($007CHasTypeFlags$007C_$007C(1, matchValue_3) != 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", 802), (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_3) != 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", 802), (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))))))));
1021
- const defaults = defaultTypeArguments(reader, item_4(0, value_8(typeReferenceNode.typeArguments)));
1022
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* Omit */ 4, [(members_3 = map_1((glueMember_2) => GlueSubstitution_substituteMember(defaults, glueMember_2), (literalMembers == null) ? members_1 : filter((glueMember_1) => {
1023
- let matchValue_5;
1024
- const glueMember = glueMember_1;
1025
- switch (glueMember.tag) {
1026
- case 0: {
1027
- matchValue_5 = glueMember.fields[0].Name;
1028
- break;
1029
- }
1030
- case 6: {
1031
- matchValue_5 = glueMember.fields[0].Name;
1032
- break;
1033
- }
1034
- case 2: {
1035
- matchValue_5 = glueMember.fields[0].Name;
1036
- break;
1037
- }
1038
- case 3: {
1039
- matchValue_5 = glueMember.fields[0].Name;
1040
- break;
1041
- }
1042
- case 4:
1043
- case 5:
1044
- case 7: {
1045
- matchValue_5 = undefined;
1046
- break;
1047
- }
1048
- default:
1049
- matchValue_5 = glueMember.fields[0].Name;
397
+ return empty();
1050
398
  }
1051
- if (matchValue_5 == null) {
1052
- return true;
399
+ };
400
+ const matchValue_1 = readResolvedLiterals(checker.getTypeAtLocation(templateLiteralTypeNode));
401
+ if (!isEmpty(matchValue_1)) {
402
+ if (isEmpty(tail(matchValue_1))) {
403
+ return head(matchValue_1);
1053
404
  }
1054
405
  else {
1055
- return !contains_1(matchValue_5, keysToOmit, {
1056
- Equals: (x_1, y_1) => (x_1 === y_1),
1057
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
1058
- });
406
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue_1)]);
1059
407
  }
1060
- }, literalMembers)), (typeReferenceNode.pos < 0) ? UtilityType_withoutForeignTypeParameters(reader, defaults, members_3) : members_3)])]);
1061
- }
1062
-
1063
- export function UtilityType_readReadonly(reader, typeReferenceNode) {
1064
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
1065
- const matchValue = typ.flags;
1066
- let matchResult;
1067
- if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
1068
- matchResult = 0;
1069
- }
1070
- else if ($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) {
1071
- matchResult = 0;
1072
408
  }
1073
409
  else {
1074
- matchResult = 1;
1075
- }
1076
- switch (matchResult) {
1077
- case 0:
1078
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* Readonly */ 5, [new GlueReadonly(/* Members */ 0, [UtilityType_readMembers(reader, typeReferenceNode, typ)])])]);
1079
- default:
1080
- if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
1081
- const unionType = typ;
1082
- try {
1083
- return new GlueType(/* UtilityType */ 26, [new GlueUtilityType(/* Readonly */ 5, [new GlueReadonly(/* Union */ 1, [toList(choose_1((innerType) => {
1084
- let copyOfStruct, Name;
1085
- if ((copyOfStruct = innerType.flags, (copyOfStruct & 524288) !== 0)) {
1086
- return (Name = item_4(0, value_8(innerType.aliasTypeArguments)).symbol.name, new GlueInterface(empty(), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getFullyQualifiedName(item_4(0, value_8(innerType.aliasTypeArguments)).symbol), Name, UtilityType_readMembers(reader, typeReferenceNode, innerType), empty(), empty()));
1087
- }
1088
- else {
1089
- return undefined;
1090
- }
1091
- }, unionType.types))])])]);
1092
- }
1093
- catch (matchValue_1) {
1094
- const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 909);
1095
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1096
- void (objectArg.push(item));
1097
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1098
- }
1099
- }
1100
- else {
1101
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1102
- }
410
+ return GlueType.TemplateLiteral;
1103
411
  }
1104
412
  }
1105
413
 
1106
414
  export function readTypeNode(reader, typeNode) {
1107
- let option_11, symbol_4, matchValue_13, matchValue_20, option_14, arg_2, symbol_5, symbol_7, symbol_8, symbol_9, matchValue_26, option_21, symbol_11, matchValue_27;
415
+ let constraintNode, typeParameters_1;
1108
416
  const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
1109
417
  const matchValue = typeNode.kind;
1110
418
  switch (matchValue) {
@@ -1116,6 +424,49 @@ export function readTypeNode(reader, typeNode) {
1116
424
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1117
425
  case 136:
1118
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
+ }
1119
470
  case 146:
1120
471
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Never]);
1121
472
  case 150:
@@ -1132,293 +483,42 @@ export function readTypeNode(reader, typeNode) {
1132
483
  return GlueType.Unknown;
1133
484
  case 163:
1134
485
  return new GlueType(/* Primitive */ 3, [GluePrimitive.BigInt$]);
1135
- case 182: {
1136
- const matchValue_11 = typeNode.assertsModifier;
1137
- if (matchValue_11 == null) {
486
+ case 183: {
487
+ const matchValue_1 = typeNode.assertsModifier;
488
+ if (matchValue_1 == null) {
1138
489
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
1139
490
  }
1140
491
  else {
1141
492
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
1142
493
  }
1143
494
  }
1144
- case 183: {
1145
- const typeReferenceNode = typeNode;
1146
- const symbolOpt = symbolAtLocation(checker, typeReferenceNode.typeName);
1147
- const readTypeReference = (isStandardLibrary) => {
1148
- let symbol_2, matchValue_4, declarations, typNode, option_7, valueDeclaration, matchValue_6;
1149
- if ((symbolOpt == null) ? false : ((symbol_2 = symbolOpt, (matchValue_4 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_4) != null)))) {
1150
- return new GlueType(/* TypeParameter */ 16, [value_8(symbolOpt).name]);
1151
- }
1152
- else {
1153
- let matchValue_5;
1154
- const option_5 = UtilityType_tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
1155
- if (option_5 != null) {
1156
- matchValue_5 = option_5;
1157
- }
1158
- else {
1159
- let isConditionalAlias;
1160
- let matchValue_1;
1161
- const option_1 = symbolOpt;
1162
- matchValue_1 = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
1163
- if (matchValue_1 == null) {
1164
- isConditionalAlias = false;
1165
- }
1166
- else {
1167
- const symbol_1 = matchValue_1;
1168
- const matchValue_2 = symbol_1.declarations;
1169
- let matchResult, declarations_1;
1170
- if (matchValue_2 != null) {
1171
- if ((declarations = matchValue_2, declarations.length > 0)) {
1172
- matchResult = 0;
1173
- declarations_1 = matchValue_2;
1174
- }
1175
- else {
1176
- matchResult = 1;
1177
- }
1178
- }
1179
- else {
1180
- matchResult = 1;
1181
- }
1182
- switch (matchResult) {
1183
- case 0: {
1184
- const declaration = item_4(0, declarations_1);
1185
- isConditionalAlias = ((declaration.kind === 265) && (declaration.type.kind === 194));
1186
- break;
1187
- }
1188
- default:
1189
- isConditionalAlias = false;
1190
- }
1191
- }
1192
- if ((typeReferenceNode.pos < 0) ? true : !isConditionalAlias) {
1193
- matchValue_5 = undefined;
1194
- }
1195
- else {
1196
- const typ = checker.getTypeFromTypeNode(typeReferenceNode);
1197
- let isUnknown;
1198
- const matchValue_3 = typ.flags;
1199
- let matchResult_1;
1200
- if ($007CHasTypeFlags$007C_$007C(1, matchValue_3) != null) {
1201
- matchResult_1 = 0;
1202
- }
1203
- else if ($007CHasTypeFlags$007C_$007C(131072, matchValue_3) != null) {
1204
- matchResult_1 = 0;
1205
- }
1206
- else {
1207
- matchResult_1 = 1;
1208
- }
1209
- switch (matchResult_1) {
1210
- case 0: {
1211
- isUnknown = true;
1212
- break;
1213
- }
1214
- default:
1215
- isUnknown = false;
1216
- }
1217
- if (isDeferredConditional(typ) ? true : isUnknown) {
1218
- matchValue_5 = undefined;
1219
- }
1220
- else {
1221
- const flags = 1 | 16384;
1222
- const option_3 = checker.typeToTypeNode(typ, typeReferenceNode, flags);
1223
- matchValue_5 = ((option_3 != null) ? ((typNode = option_3, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode))) : undefined);
1224
- }
1225
- }
1226
- }
1227
- if (matchValue_5 == null) {
1228
- const isQualified = typeReferenceNode.typeName.kind === 166;
1229
- const writtenName = () => {
1230
- if (isQualified) {
1231
- return typeReferenceNode.typeName.right.text;
1232
- }
1233
- else {
1234
- return identifierText(typeReferenceNode.typeName);
1235
- }
1236
- };
1237
- let name;
1238
- if (symbolOpt == null) {
1239
- name = writtenName();
1240
- }
1241
- else {
1242
- const symbol_3 = symbolOpt;
1243
- name = defaultArg(orElse(importedName(checker, symbol_3), (option_7 = symbol_3.valueDeclaration, (option_7 != null) ? ((valueDeclaration = option_7, (matchValue_6 = valueDeclaration.kind, (matchValue_6 === 266) ? (isQualified ? symbol_3.name : writtenName()) : ((matchValue_6 === 306) ? (valueDeclaration.symbol.parent.getName()) : writtenName())))) : undefined)), writtenName());
1244
- }
1245
- const isUnresolved = ((reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && (symbolOpt == null)) && (typeReferenceNode.pos >= 0);
1246
- const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
1247
- if (isUnresolved ? true : (isExternal && !FSharpSet__Contains(knownExternalTypeNames, name))) {
1248
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1249
- }
1250
- else {
1251
- 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, symbolOpt), truncateToDeclaredArity(reader, symbolOpt, readTypeArguments(reader, typeReferenceNode)), (isStandardLibrary ? true : isExternal) ? true : isLibraryName(reader, name))]);
1252
- }
1253
- }
1254
- else {
1255
- return matchValue_5;
1256
- }
1257
- }
1258
- };
1259
- if (((entityNameText(typeReferenceNode.typeName) === "NoInfer") && (typeReferenceNode.typeArguments != null)) && ((((option_11 = symbolOpt, (option_11 != null) ? ((symbol_4 = option_11, symbol_4.declarations)) : undefined)) == null) ? true : isFromEs5Lib(symbolOpt))) {
1260
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](item_4(0, value_8(typeReferenceNode.typeArguments)));
1261
- }
1262
- else if (isFromEs5Lib(symbolOpt)) {
1263
- const matchValue_10 = getFullNameOrEmpty(checker, typeReferenceNode.typeName);
1264
- switch (matchValue_10) {
1265
- case "Exclude":
1266
- return UtilityType_readExclude(reader, typeReferenceNode);
1267
- case "Uppercase":
1268
- case "Lowercase":
1269
- case "Capitalize":
1270
- case "Uncapitalize": {
1271
- const literals = (typ_1) => {
1272
- const matchValue_7 = typ_1.flags;
1273
- if ($007CHasTypeFlags$007C_$007C(128, matchValue_7) != null) {
1274
- const activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ_1);
1275
- if (activePatternResult_4.tag === 1) {
1276
- return undefined;
1277
- }
1278
- else {
1279
- return singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_4.fields[0]])]));
1280
- }
1281
- }
1282
- else if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_7) != null) {
1283
- return fold((acc, cases) => {
1284
- let matchResult_2, acc_1, cases_1;
1285
- if (acc != null) {
1286
- if (cases != null) {
1287
- matchResult_2 = 0;
1288
- acc_1 = acc;
1289
- cases_1 = cases;
1290
- }
1291
- else {
1292
- matchResult_2 = 1;
1293
- }
1294
- }
1295
- else {
1296
- matchResult_2 = 1;
1297
- }
1298
- switch (matchResult_2) {
1299
- case 0:
1300
- return append_1(acc_1, cases_1);
1301
- default:
1302
- return undefined;
1303
- }
1304
- }, empty(), map_1(literals, toList(typ_1.types)));
1305
- }
1306
- else {
1307
- return undefined;
1308
- }
1309
- };
1310
- if (typeReferenceNode.pos < 0) {
1311
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
1312
- }
1313
- else {
1314
- const matchValue_9 = literals(checker.getTypeFromTypeNode(typeReferenceNode));
1315
- let matchResult_3, single, cases_2;
1316
- if (matchValue_9 != null) {
1317
- if (!isEmpty(matchValue_9)) {
1318
- if (isEmpty(tail(matchValue_9))) {
1319
- matchResult_3 = 0;
1320
- single = head(matchValue_9);
1321
- }
1322
- else {
1323
- matchResult_3 = 1;
1324
- cases_2 = matchValue_9;
1325
- }
1326
- }
1327
- else {
1328
- matchResult_3 = 2;
1329
- }
1330
- }
1331
- else {
1332
- matchResult_3 = 2;
1333
- }
1334
- switch (matchResult_3) {
1335
- case 0:
1336
- return single;
1337
- case 1:
1338
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(cases_2)]);
1339
- default:
1340
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
1341
- }
1342
- }
1343
- }
1344
- case "Partial":
1345
- return UtilityType_readPartial(reader, typeReferenceNode);
1346
- case "Record":
1347
- return UtilityType_readRecord(reader, typeReferenceNode);
1348
- case "ReturnType":
1349
- return UtilityType_readReturnType(reader, typeReferenceNode);
1350
- case "ThisParameterType":
1351
- return UtilityType_readThisParameterType(reader, typeReferenceNode);
1352
- case "Omit":
1353
- return UtilityType_readOmit(reader, typeReferenceNode);
1354
- case "Readonly":
1355
- return UtilityType_readReadonly(reader, typeReferenceNode);
1356
- default:
1357
- return readTypeReference(true);
1358
- }
1359
- }
1360
- else {
1361
- return readTypeReference(isFromEsLib(symbolOpt));
1362
- }
1363
- }
1364
- case 184: {
1365
- const functionTypeNode = typeNode;
1366
- let typeParameters;
1367
- const collectEnclosing = (node_mut, acc_2_mut) => {
1368
- collectEnclosing:
1369
- while (true) {
1370
- const node = node_mut, acc_2 = acc_2_mut;
1371
- if (Operators_IsNull(node)) {
1372
- return acc_2;
1373
- }
1374
- else if (((Operators_IsNull(node.parent) && (node.pos < 0)) && (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]() != null)) && !(node === value_8(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]()))) {
1375
- node_mut = value_8(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]());
1376
- acc_2_mut = acc_2;
1377
- continue collectEnclosing;
1378
- }
1379
- else if (node.kind === 168) {
1380
- return empty();
1381
- }
1382
- else {
1383
- const ownTypeParameters = node.typeParameters;
1384
- const acc_3 = (ownTypeParameters == null) ? acc_2 : append_1(acc_2, toList(ownTypeParameters));
1385
- node_mut = node.parent;
1386
- acc_2_mut = acc_3;
1387
- continue collectEnclosing;
1388
- }
1389
- break;
1390
- }
1391
- };
1392
- const matchValue_12 = List_distinctBy((typeParameter) => identifierText(typeParameter.name), collectEnclosing(functionTypeNode, empty()), {
1393
- Equals: (x, y) => (x === y),
1394
- GetHashCode: (x) => (stringHash(x) | 0),
1395
- });
1396
- typeParameters = (isEmpty(matchValue_12) ? empty() : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4088FB9E"](Array.from(matchValue_12)));
1397
- 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_13 = functionTypeNode.typeParameters, (matchValue_13 == null) ? empty() : toList(map((typeParameter_1) => identifierText(typeParameter_1.name), matchValue_13))), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParametersZ17143B5B"](functionTypeNode.parameters))]);
1398
- }
1399
- case 185: {
495
+ case 184:
496
+ return readTypeReference(reader, typeNode);
497
+ case 185:
498
+ return readFunctionType(reader, typeNode);
499
+ case 186: {
1400
500
  const constructorTypeNode = typeNode;
1401
- return new GlueType(/* ConstructorType */ 28, [new GlueConstructSignature(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParametersZ17143B5B"](constructorTypeNode.parameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constructorTypeNode.type))]);
501
+ return new GlueType(/* ConstructorType */ 29, [new GlueConstructSignature(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](constructorTypeNode.parameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constructorTypeNode.type))]);
1402
502
  }
1403
- case 186:
503
+ case 187:
1404
504
  return readTypeQueryNode(reader, typeNode);
1405
- case 187: {
505
+ case 188: {
1406
506
  const typeLiteralNode = typeNode;
1407
- return new GlueType(/* TypeLiteral */ 21, [new GlueTypeLiteral(map_1((declaration_6) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_6), toList(typeLiteralNode.members)))]);
507
+ return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(map((declaration) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration), toList(typeLiteralNode.members)), typeLiteralId(typeLiteralNode))]);
1408
508
  }
1409
- case 188: {
509
+ case 189: {
1410
510
  const arrayTypeNode = typeNode;
1411
511
  return new GlueType(/* Array */ 14, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](arrayTypeNode.elementType)]);
1412
512
  }
1413
- case 189: {
513
+ case 190: {
1414
514
  const tupleTypeNode = typeNode;
1415
- const elements = map_1((value_4) => value_4, toList(tupleTypeNode.elements));
1416
- if (exists_1((element) => (element.kind === 191), elements)) {
1417
- const elementTypes = List_distinct(map_1((element_1) => {
1418
- if (element_1.kind === 191) {
1419
- const matchValue_18 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type);
1420
- if (matchValue_18.tag === 14) {
1421
- return matchValue_18.fields[0];
515
+ const elements = map((value) => value, toList(tupleTypeNode.elements));
516
+ if (exists_1((element) => (element.kind === 192), elements)) {
517
+ const elementTypes = List_distinct(map((element_1) => {
518
+ if (element_1.kind === 192) {
519
+ const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type);
520
+ if (matchValue_3.tag === 14) {
521
+ return matchValue_3.fields[0];
1422
522
  }
1423
523
  else {
1424
524
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -1429,22 +529,22 @@ export function readTypeNode(reader, typeNode) {
1429
529
  }
1430
530
  }, elements), {
1431
531
  Equals: equals,
1432
- GetHashCode: (x_2) => (safeHash(x_2) | 0),
532
+ GetHashCode: (x) => (safeHash(x) | 0),
1433
533
  });
1434
- let matchResult_4, elementType_2;
534
+ let matchResult_2, elementType_2;
1435
535
  if (!isEmpty(elementTypes)) {
1436
536
  if (isEmpty(tail(elementTypes))) {
1437
- matchResult_4 = 0;
537
+ matchResult_2 = 0;
1438
538
  elementType_2 = head(elementTypes);
1439
539
  }
1440
540
  else {
1441
- matchResult_4 = 1;
541
+ matchResult_2 = 1;
1442
542
  }
1443
543
  }
1444
544
  else {
1445
- matchResult_4 = 1;
545
+ matchResult_2 = 1;
1446
546
  }
1447
- switch (matchResult_4) {
547
+ switch (matchResult_2) {
1448
548
  case 0:
1449
549
  return new GlueType(/* Array */ 14, [elementType_2]);
1450
550
  default:
@@ -1452,321 +552,86 @@ export function readTypeNode(reader, typeNode) {
1452
552
  }
1453
553
  }
1454
554
  else {
1455
- return new GlueType(/* TupleType */ 18, [map_1((typNode_3) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_3), elements)]);
555
+ return new GlueType(/* TupleType */ 18, [map((typNode) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode), elements)]);
1456
556
  }
1457
557
  }
1458
- case 190: {
558
+ case 191: {
1459
559
  const optionalTypeNode = typeNode;
1460
- return new GlueType(/* OptionalType */ 22, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](optionalTypeNode.type)]);
560
+ return new GlueType(/* OptionalType */ 23, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](optionalTypeNode.type)]);
1461
561
  }
1462
- case 191:
1463
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode.type);
1464
562
  case 192:
1465
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadUnionTypeNodeZ5A082EC2"](typeNode);
563
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode.type);
1466
564
  case 193:
1467
- if (exists((inProgress) => (inProgress === checker.getTypeAtLocation(typeNode)), intersectionsInProgress)) {
565
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadUnionTypeNodeZ5A082EC2"](typeNode);
566
+ case 194:
567
+ if (exists((inProgress) => (inProgress === checker.getTypeAtLocation(typeNode)), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections)) {
1468
568
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1469
569
  }
1470
570
  else if (exists(isGlobalThisQuery, typeNode.types)) {
1471
- const matchValue_19 = toList(filter_1((arg_3) => !isGlobalThisQuery(arg_3), typeNode.types));
1472
- let matchResult_5, single_1;
1473
- if (!isEmpty(matchValue_19)) {
1474
- if (isEmpty(tail(matchValue_19))) {
1475
- matchResult_5 = 0;
1476
- single_1 = head(matchValue_19);
571
+ const matchValue_4 = toList(filter((arg) => !isGlobalThisQuery(arg), typeNode.types));
572
+ let matchResult_3, single;
573
+ if (!isEmpty(matchValue_4)) {
574
+ if (isEmpty(tail(matchValue_4))) {
575
+ matchResult_3 = 0;
576
+ single = head(matchValue_4);
1477
577
  }
1478
578
  else {
1479
- matchResult_5 = 1;
579
+ matchResult_3 = 1;
1480
580
  }
1481
581
  }
1482
582
  else {
1483
- matchResult_5 = 1;
583
+ matchResult_3 = 1;
1484
584
  }
1485
- switch (matchResult_5) {
585
+ switch (matchResult_3) {
1486
586
  case 0:
1487
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single_1);
587
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
1488
588
  default:
1489
589
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1490
590
  }
1491
591
  }
1492
592
  else {
1493
- const intersectionTypeNode = typeNode;
1494
- const unionOrIntersectionType = checker.getTypeAtLocation(intersectionTypeNode);
1495
- void (intersectionsInProgress.push(unionOrIntersectionType));
1496
- const _guard = {
1497
- Dispose() {
1498
- intersectionsInProgress.splice(intersectionsInProgress.length - 1, 1);
1499
- },
1500
- };
1501
- try {
1502
- const properties_1 = choose((property_1) => {
1503
- const matchValue_21 = property_1.declarations;
1504
- if (matchValue_21 == null) {
1505
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
1506
- }
1507
- else {
1508
- const declarations_3 = matchValue_21;
1509
- if (declarations_3.length === 1) {
1510
- return new IntersectionTypePropertyResult(/* Single */ 0, [property_1, item_4(0, declarations_3)]);
1511
- }
1512
- else if (forAll((declaration_2) => {
1513
- if (declaration_2.kind === 171) {
1514
- return true;
1515
- }
1516
- else {
1517
- return declaration_2.kind === 172;
1518
- }
1519
- }, declarations_3)) {
1520
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
1521
- }
1522
- else {
1523
- return IntersectionTypePropertyResult.ForceAny;
1524
- }
1525
- }
1526
- }, unionOrIntersectionType.isUnion() ? List_distinct(concat_2(map_1((arg_4) => toList(checker.getPropertiesOfType(arg_4)), toList(unionOrIntersectionType.types))), {
1527
- Equals: equals,
1528
- GetHashCode: (x_3) => (structuralHash(x_3) | 0),
1529
- }) : ((matchValue_20 = toList(unionOrIntersectionType.getProperties()), isEmpty(matchValue_20) ? ((intersectionTypeNode.pos >= 0) ? List_distinctBy((property) => property.name, collect_1((constituent) => {
1530
- let type_1;
1531
- return toList((type_1 = checker.getTypeAtLocation(constituent), checker.getPropertiesOfType(type_1)));
1532
- }, toList(intersectionTypeNode.types)), {
1533
- Equals: (x_4, y_4) => (x_4 === y_4),
1534
- GetHashCode: (x_4) => (stringHash(x_4) | 0),
1535
- }) : matchValue_20) : matchValue_20)));
1536
- const hasUnsupportedProperties = exists_1((property_2) => {
1537
- switch (property_2.tag) {
1538
- case 1:
1539
- return false;
1540
- case 0:
1541
- if (property_2.fields[1].kind === 174) {
1542
- return true;
1543
- }
1544
- else {
1545
- return false;
1546
- }
1547
- default:
1548
- return true;
1549
- }
1550
- }, properties_1);
1551
- const callSignatures = unionOrIntersectionType.isUnion() ? empty() : choose((signature) => {
1552
- const flags_1 = 1 | 16384;
1553
- const synthesized = checker.signatureToSignatureDeclaration(signature, 179, typeNode, flags_1);
1554
- if (synthesized == null) {
1555
- return undefined;
1556
- }
1557
- else {
1558
- const declaration_4 = synthesized;
1559
- declaration_4.parent = typeNode;
1560
- const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
1561
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_4);
1562
- try {
1563
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_4);
1564
- }
1565
- finally {
1566
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
1567
- }
1568
- }
1569
- }, toList(checker.getSignaturesOfType(unionOrIntersectionType, 0)));
1570
- return hasUnsupportedProperties ? (new GlueType(/* Primitive */ 3, [GluePrimitive.Any])) : (new GlueType(/* IntersectionType */ 20, [append_1(choose((_arg) => {
1571
- switch (_arg.tag) {
1572
- case 1:
1573
- return readPropertyWithoutDeclaration(reader, typeNode, _arg.fields[0]);
1574
- case 2:
1575
- throw new Exception("Sould not happen here");
1576
- default:
1577
- return readInstantiatedMember(reader, typeNode, _arg.fields[0], _arg.fields[1]);
1578
- }
1579
- }, properties_1), callSignatures)]));
1580
- }
1581
- finally {
1582
- disposeSafe(_guard);
1583
- }
1584
- }
1585
- case 194: {
1586
- const conditionalTypeNode = typeNode;
1587
- const typ_4 = checker.getTypeAtLocation(conditionalTypeNode);
1588
- if (isDeferredConditional(typ_4)) {
1589
- const warningsCount = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length | 0;
1590
- const inferred = ofList(map_1((inferTypeNode) => [inferTypeNode.typeParameter.name.getText(), inferredConstraint(reader, inferTypeNode)], inferTypeNodes(conditionalTypeNode.extendsType)), {
1591
- Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
1592
- });
1593
- const conditionalType = new GlueConditionalType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.checkType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.extendsType), GlueSubstitution_substitute(inferred, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.trueType)), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.falseType));
1594
- if (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length > warningsCount) {
1595
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().splice(warningsCount, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length - warningsCount);
1596
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1597
- }
1598
- else {
1599
- return new GlueType(/* ConditionalType */ 32, [conditionalType]);
1600
- }
1601
- }
1602
- else {
1603
- const matchValue_28 = readTypeUsingFlags(reader, typ_4);
1604
- let matchResult_6, forward;
1605
- if (matchValue_28.tag === 3) {
1606
- if (matchValue_28.fields[0].tag === 6) {
1607
- matchResult_6 = 0;
1608
- }
1609
- else {
1610
- matchResult_6 = 1;
1611
- forward = matchValue_28;
1612
- }
1613
- }
1614
- else {
1615
- matchResult_6 = 1;
1616
- forward = matchValue_28;
1617
- }
1618
- switch (matchResult_6) {
1619
- case 0:
1620
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.checkType);
1621
- default:
1622
- return forward;
1623
- }
593
+ return readIntersectionType(reader, typeNode);
1624
594
  }
1625
- }
1626
595
  case 195:
1627
- return inferredConstraint(reader, typeNode);
1628
- case 196: {
596
+ return readConditionalType(reader, typeNode);
597
+ case 196:
598
+ return new GlueType(/* TypeParameter */ 16, [typeNode.typeParameter.name.getText()]);
599
+ case 197: {
1629
600
  const parenthesizedTypeNode = typeNode;
1630
601
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](parenthesizedTypeNode.type);
1631
602
  }
1632
- case 197: {
1633
- const thisTypeNode = typeNode;
1634
- const typ_2 = checker.getTypeAtLocation(thisTypeNode);
1635
- let typParameters_1;
1636
- const matchValue_16 = Operators_IsNull(typ_2.symbol) ? undefined : typ_2.symbol.declarations;
1637
- typParameters_1 = ((matchValue_16 == null) ? empty() : defaultArg((option_14 = tryHead(sortByDescending((typeParameters_1) => (typeParameters_1.length | 0), choose_1((declaration_1) => {
1638
- const matchValue_17 = declaration_1.kind;
1639
- switch (matchValue_17) {
1640
- case 263:
1641
- case 264: {
1642
- const classDeclaration = declaration_1;
1643
- return classDeclaration.typeParameters;
1644
- }
1645
- default:
1646
- return undefined;
1647
- }
1648
- }, matchValue_16), {
1649
- Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
1650
- })), (option_14 != null) ? ((arg_2 = option_14, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4088FB9E"](arg_2))) : undefined), empty()));
1651
- if (Operators_IsNull(typ_2.symbol)) {
1652
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1653
- }
1654
- else {
1655
- return new GlueType(/* ThisType */ 17, [new GlueThisType(defaultArg(declaredName(typ_2.symbol), typ_2.symbol.name), typParameters_1)]);
1656
- }
1657
- }
1658
- case 198: {
603
+ case 198:
604
+ return readThisType(reader, typeNode);
605
+ case 199: {
1659
606
  const typeOperatorNode = typeNode;
1660
607
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode);
1661
608
  }
1662
- case 199: {
609
+ case 200: {
1663
610
  const indexedAccessType = typeNode;
1664
611
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadIndexedAccessTypeZ5577BC0A"](indexedAccessType);
1665
612
  }
1666
- case 200:
613
+ case 201:
1667
614
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadMappedTypeNode28272C00"](typeNode);
1668
- case 201: {
615
+ case 202: {
1669
616
  const literalTypeNode = typeNode;
1670
- const matchValue_15 = tryReadLiteral(checker, literalTypeNode.literal);
1671
- if (matchValue_15 == null) {
1672
- throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1217));
617
+ const matchValue_2 = tryReadLiteral(checker, literalTypeNode.literal);
618
+ 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", 451));
1673
620
  }
1674
621
  else {
1675
- return new GlueType(/* Literal */ 8, [matchValue_15]);
622
+ return new GlueType(/* Literal */ 8, [matchValue_2]);
1676
623
  }
1677
624
  }
1678
- case 202:
625
+ case 203:
1679
626
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNamedTupleMemberZ6E17C942"](typeNode);
1680
- case 203: {
1681
- const templateLiteralTypeNode = typeNode;
1682
- const readResolvedLiterals = (typ_6) => {
1683
- const matchValue_29 = typ_6.flags;
1684
- if ($007CHasTypeFlags$007C_$007C(128, matchValue_29) != null) {
1685
- const activePatternResult_7 = Type_StringLiteral_$007CString$007COther$007C(typ_6);
1686
- if (activePatternResult_7.tag === 1) {
1687
- return empty();
1688
- }
1689
- else {
1690
- return singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_7.fields[0]])]));
1691
- }
1692
- }
1693
- else if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_29) != null) {
1694
- return collect_1(readResolvedLiterals, toList(typ_6.types));
1695
- }
1696
- else {
1697
- return empty();
1698
- }
1699
- };
1700
- const matchValue_30 = readResolvedLiterals(checker.getTypeAtLocation(templateLiteralTypeNode));
1701
- if (!isEmpty(matchValue_30)) {
1702
- if (isEmpty(tail(matchValue_30))) {
1703
- return head(matchValue_30);
1704
- }
1705
- else {
1706
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue_30)]);
1707
- }
1708
- }
1709
- else {
1710
- return GlueType.TemplateLiteral;
1711
- }
1712
- }
1713
- case 205: {
1714
- const importTypeNode = typeNode;
1715
- const matchValue_14 = importTypeNode.qualifier;
1716
- if (matchValue_14 == null) {
1717
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1718
- }
1719
- else if (importTypeNode.isTypeOf) {
1720
- const qualifier_1 = matchValue_14;
1721
- const typNode_1 = ts.factory.createTypeQueryNode(qualifier_1);
1722
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_1);
1723
- }
1724
- else {
1725
- const qualifier_2 = matchValue_14;
1726
- const typNode_2 = ts.factory.createTypeReferenceNode(qualifier_2, unwrap(importTypeNode.typeArguments));
1727
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_2);
1728
- }
1729
- }
1730
- case 233: {
1731
- const expression = typeNode;
1732
- const typ_3 = checker.getTypeFromTypeNode(expression);
1733
- const symbolOpt_1 = orElse(orElse(typ_3.aliasSymbol, Operators_IsNull(typ_3.symbol) ? undefined : typ_3.symbol), checker.getSymbolAtLocation(expression.expression));
1734
- const matchValue_23 = isFromEs5Lib(symbolOpt_1);
1735
- const matchValue_24 = getFullNameOrEmpty(checker, expression.expression);
1736
- let matchResult_7;
1737
- if (matchValue_23) {
1738
- if (matchValue_24 === "Omit") {
1739
- matchResult_7 = 0;
1740
- }
1741
- else {
1742
- matchResult_7 = 1;
1743
- }
1744
- }
1745
- else {
1746
- matchResult_7 = 1;
1747
- }
1748
- switch (matchResult_7) {
1749
- case 0:
1750
- return UtilityType_readOmit(reader, expression);
1751
- default: {
1752
- const isQualified_1 = expression.expression.kind === 211;
1753
- const name_1 = (symbolOpt_1 != null) ? (((symbol_5 = symbolOpt_1, symbol_5.name === "default")) ? ((symbol_7 = symbolOpt_1, defaultArg(declaredName(symbol_7), symbol_7.name))) : ((!isFromEs5Lib(symbolOpt_1)) ? ((symbol_8 = symbolOpt_1, symbol_8.name)) : (isQualified_1 ? expression.expression.name.text : expression.expression.getText()))) : (isQualified_1 ? expression.expression.name.text : expression.expression.getText());
1754
- const isExternal_1 = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt_1);
1755
- if (((symbolOpt_1 == null) ? false : ((symbol_9 = symbolOpt_1, (symbol_9.name === "__type") ? true : (symbol_9.name === "__object")))) ? true : ((isExternal_1 && !FSharpSet__Contains(knownExternalTypeNames, name_1)) && !(isFromEs5Lib(symbolOpt_1) && (name_1 === "Partial")))) {
1756
- return GlueType.Discard;
1757
- }
1758
- else {
1759
- return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name_1.indexOf(".") >= 0) ? name_1 : sanitizeTypeName(name_1), (matchValue_26 = ((option_21 = symbolOpt_1, (option_21 != null) ? resolveAlias(checker, option_21) : undefined)), (matchValue_26 == null) ? getFullNameOrEmpty(checker, expression.expression) : ((symbol_11 = matchValue_26, checker.getFullyQualifiedName(symbol_11)))), isLibraryName(reader, name_1) ? empty() : modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), isQualified_1, symbolOpt_1), (matchValue_27 = readTypeArguments(reader, expression), isEmpty(matchValue_27) ? map_1((argument) => {
1760
- const flags_2 = 1 | 16384;
1761
- const typNode_4 = checker.typeToTypeNode(argument, undefined, flags_2);
1762
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode_4);
1763
- }, resolvedBaseTypeArguments(checker, expression)) : matchValue_27), (isFromEs5Lib(symbolOpt_1) ? true : isExternal_1) ? true : isLibraryName(reader, name_1))]);
1764
- }
1765
- }
1766
- }
1767
- }
627
+ case 204:
628
+ return readTemplateLiteralType(reader, typeNode);
629
+ case 206:
630
+ return readImportType(reader, typeNode);
631
+ case 234:
632
+ return readExpressionWithTypeArguments(reader, typeNode);
1768
633
  default: {
1769
- 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", 1671);
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);
1770
635
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1771
636
  void (objectArg.push(item));
1772
637
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);