@glutinum/cli 1.0.0-beta.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 (56) 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 +116 -65
  6. package/dist/Glutinum.Converter/Generate.js +38 -25
  7. package/dist/Glutinum.Converter/GlueAST.js +82 -43
  8. package/dist/Glutinum.Converter/Hosting.js +143 -169
  9. package/dist/Glutinum.Converter/Merge.js +369 -337
  10. package/dist/Glutinum.Converter/Packages.js +384 -94
  11. package/dist/Glutinum.Converter/Printer.js +432 -393
  12. package/dist/Glutinum.Converter/Read.js +361 -99
  13. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +4 -4
  14. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
  15. package/dist/Glutinum.Converter/Reader/Declaration.js +6 -12
  16. package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
  17. package/dist/Glutinum.Converter/Reader/Documentation.js +23 -35
  18. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +103 -36
  19. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +21 -36
  20. package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
  21. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +26 -13
  22. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +15 -21
  23. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +45 -2
  24. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
  25. package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
  26. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +53 -5
  27. package/dist/Glutinum.Converter/Reader/Node.js +8 -11
  28. package/dist/Glutinum.Converter/Reader/Parameters.js +36 -27
  29. package/dist/Glutinum.Converter/Reader/TypeNode.js +389 -1583
  30. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +76 -49
  31. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +14 -37
  32. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +23 -5
  33. package/dist/Glutinum.Converter/Reader/Types.js +295 -15
  34. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +14 -28
  35. package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
  36. package/dist/Glutinum.Converter/Reader/Utils.js +487 -101
  37. package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
  38. package/dist/Glutinum.Converter/Transform.js +2915 -8176
  39. package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
  40. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
  41. package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
  42. package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
  43. package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
  44. package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
  45. package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
  46. package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
  47. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
  48. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
  49. package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
  50. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
  51. package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +356 -0
  52. package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
  53. package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
  54. package/dist/Glutinum.Converter/Utils/String.js +14 -3
  55. package/dist/Program.js +102 -239
  56. package/package.json +3 -2
@@ -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 { forAll as forAll_1, 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, typeLiteralId, 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 { unwrap, orElse, value as value_8, defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
12
- import { contains as contains_2, item as item_4 } from "../../fable_modules/fable-library-js.5.17.2/Array.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";
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";
18
15
  import { ts } from "@ts-morph/bootstrap";
16
+ import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
19
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(67108864, 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 === 196) ? 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 === 184) {
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;
39
+ option_7 = option_5;
189
40
  }
190
41
  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 === 264) ? declaration.typeParameters : ((matchValue === 265) ? declaration.typeParameters : ((matchValue === 266) ? declaration.typeParameters : undefined)));
198
- }
199
- 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) ? (typeParameters[position_1]).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 264:
254
- case 265:
255
- case 266: {
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 === 187) {
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(1048576, 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(1048576, 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 264:
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 265:
328
- case 266: {
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 268:
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(32, matchValue) != null) {
350
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
351
- }
352
- else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
353
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
354
- }
355
- else if ($007CHasTypeFlags$007C_$007C(256, 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(16, 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(1024, matchValue) != null) {
376
- matchResult = 0;
377
- }
378
- else if ($007CHasTypeFlags$007C_$007C(2048, matchValue) != null) {
379
- matchResult = 0;
380
- }
381
- else if ($007CHasTypeFlags$007C_$007C(134217728, 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(1024, matchValue_1) != null) ? ((activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ), (activePatternResult_4.tag === 1) ? (((item = Report_readerError_Z19516DCE("Exclude", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 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(2048, 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(1024, 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(2048, 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(67108864, matchValue) != null) {
417
- if ((matchValue_3 = typeReferenceNode.typeArguments, (matchValue_3 != null) && (((typeArguments = matchValue_3, ~~typeArguments.length > 1)) && ((typeArguments_1 = matchValue_3, (excluded = (typeArguments_1[0]), (isNullish = ((typeNode) => {
418
- const matchValue_4 = typeNode.kind;
419
- switch (matchValue_4) {
420
- case 157:
421
- return true;
422
- case 193:
423
- return forAll(isNullish, typeNode.types);
424
- case 202:
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(typeArguments_1[1]) ? true : (excluded.kind === 200)) ? true : ((excluded.kind === 184) && ((matchValue_5 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded.typeName), (matchValue_5 == null) ? false : ((symbol = matchValue_5, (matchValue_6 = symbol.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_6) != null))))))))))))) {
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 = (typeArguments_3[0]), (isNullish_1 = ((typeNode_1) => {
434
- const matchValue_8 = typeNode_1.kind;
435
- switch (matchValue_8) {
436
- case 157:
437
- return true;
438
- case 193:
439
- return forAll(isNullish_1, typeNode_1.types);
440
- case 202:
441
- return typeNode_1.literal.kind === 106;
442
- default:
443
- return false;
444
- }
445
- }), (isNullish_1(typeArguments_3[1]) ? true : (excluded_1.kind === 200)) ? true : ((excluded_1.kind === 184) && ((matchValue_9 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded_1.typeName), (matchValue_9 == null) ? false : ((symbol_1 = matchValue_9, (matchValue_10 = symbol_1.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_10) != null))))))))))))) {
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 = (typeArguments_5[0]), (isNullish_2 = ((typeNode_2) => {
458
- const matchValue_12 = typeNode_2.kind;
459
- switch (matchValue_12) {
460
- case 157:
461
- return true;
462
- case 193:
463
- return forAll(isNullish_2, typeNode_2.types);
464
- case 202:
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;
98
+ isUnknown = false;
468
99
  }
469
- }), (isNullish_2(typeArguments_5[1]) ? true : (excluded_2.kind === 200)) ? true : ((excluded_2.kind === 184) && ((matchValue_13 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(excluded_2.typeName), (matchValue_13 == null) ? false : ((symbol_2 = matchValue_13, (matchValue_14 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_14) != null))))))))))))) {
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"](value_8(typeReferenceNode.typeArguments)[0]);
482
- default:
483
- if ($007CHasTypeFlags$007C_$007C(32, matchValue) != null) {
484
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
485
- }
486
- else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
487
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
488
- }
489
- else if ($007CHasTypeFlags$007C_$007C(256, 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 264:
544
- case 265:
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(1048576, 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(524288, 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(1048576, 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(1048576, 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 */ 22, [new GlueTypeLiteral(members, undefined)]);
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(32, matchValue_7) != null) {
631
- if (isTypeAliasApplication) {
632
- matchResult_2 = 0;
633
- }
634
- else if ($007CHasTypeFlags$007C_$007C(64, matchValue_7) != null) {
635
- if (isTypeAliasApplication) {
636
- matchResult_2 = 0;
637
- }
638
- else if ($007CHasTypeFlags$007C_$007C(256, 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(256, 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,454 +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(64, matchValue_7) != null) {
663
- if (isTypeAliasApplication) {
664
- matchResult_2 = 0;
665
- }
666
- else if ($007CHasTypeFlags$007C_$007C(256, 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(256, 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 === 184)) {
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 193:
735
- return collect_1(UtilityType_literalKeysOf, toList(typeNode.types));
736
- case 197: {
737
- typeNode_mut = typeNode.type;
738
- continue UtilityType_literalKeysOf;
739
- }
740
- case 202: {
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, value_8(typeReferenceNode.typeArguments)[0]);
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", 628);
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 = value_8(typeReferenceNode.typeArguments)[0];
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 === 188)) {
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 === 22) ? 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", 671);
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, value_8(typeReferenceNode.typeArguments)[0]);
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 */ 27, [new GlueUtilityType(/* Partial */ 0, [new GlueInterface(empty(), getFullNameOrEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), typeReferenceNode), entityNameText(typeReferenceNode.typeName), members_2, empty(), empty())])]);
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 */ 27, [new GlueUtilityType(/* Record */ 1, [new GlueRecord(item_5(0, typeArguments), item_5(1, typeArguments))])]);
893
- }
894
-
895
- export function UtilityType_readReturnType(reader, typeReferenceNode) {
896
- let matchValue_4, matchValue_1, symbol, matchValue_2, declarations, declarations_1;
897
- const rawTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
898
- let typ;
899
- const matchValue = rawTyp.flags;
900
- let matchResult;
901
- if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
902
- matchResult = 0;
903
- }
904
- else if ($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) {
905
- matchResult = 0;
906
- }
907
- else if ($007CHasTypeFlags$007C_$007C(16777216, matchValue) != null) {
908
- matchResult = 0;
909
- }
910
- else if ($007CHasTypeFlags$007C_$007C(2097152, matchValue) != null) {
911
- matchResult = 0;
912
- }
913
- else {
914
- matchResult = 1;
915
- }
916
- switch (matchResult) {
917
- case 0: {
918
- typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getApparentType(rawTyp);
919
297
  break;
920
298
  }
921
- default:
922
- typ = rawTyp;
923
- }
924
- const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
925
- if (matchValue_3 == null) {
926
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ReturnType */ 2, [readTypeUsingFlags(reader, typ)])]);
927
- }
928
- else {
929
- const typeNode = matchValue_3;
930
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ReturnType */ 2, [(matchValue_4 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode), (matchValue_4.tag === 22) ? ((matchValue_4.fields[0].Id == null) ? (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(matchValue_4.fields[0].Members, (matchValue_1 = typ.getSymbol(), (matchValue_1 == null) ? undefined : ((symbol = matchValue_1, (matchValue_2 = symbol.declarations, (matchValue_2 != null) ? (((declarations = matchValue_2, declarations.length > 0)) ? ((declarations_1 = matchValue_2, typeLiteralId(item_4(0, declarations_1)))) : undefined) : undefined)))))])) : matchValue_4) : matchValue_4)])]);
931
- }
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))]);
932
306
  }
933
307
 
934
- export function UtilityType_readThisParameterType(reader, typeReferenceNode) {
935
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
936
- const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
937
- if (matchValue == null) {
938
- return new GlueType(/* UtilityType */ 27, [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);
939
318
  }
940
319
  else {
941
- const typeNode = matchValue;
942
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ThisParameterType */ 3, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode)])]);
320
+ unresolvedModule = undefined;
943
321
  }
944
- }
945
-
946
- export function UtilityType_readOmit(reader, typeReferenceNode) {
947
- let option_1, matchValue_3, item_1, objectArg_2, objectArg_3, members_3;
948
- let keysToOmitType;
949
- const node = value_8(typeReferenceNode.typeArguments)[1];
950
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
951
- keysToOmitType = objectArg.getTypeFromTypeNode(node);
952
- const tryReadValueOfKeys = (typ) => {
953
- const activePatternResult = Type_StringLiteral_$007CString$007COther$007C(typ);
954
- if (activePatternResult.tag === 1) {
955
- const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 782);
956
- const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
957
- void (objectArg_1.push(item));
958
- return undefined;
959
- }
960
- else {
961
- 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]);
962
326
  }
963
- };
964
- let keysToOmit;
965
- const matchValue = keysToOmitType.flags;
966
- let matchResult;
967
- if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
968
- if (typeReferenceNode.pos < 0) {
969
- 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);
970
331
  }
971
332
  else {
972
- 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);
973
336
  }
974
337
  }
975
338
  else {
976
- matchResult = 1;
977
- }
978
- switch (matchResult) {
979
- case 0: {
980
- keysToOmit = ofList_1(UtilityType_literalKeysOf(value_8(typeReferenceNode.typeArguments)[1]));
981
- 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));
982
346
  }
983
- default:
984
- 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]);
985
348
  }
986
- const baseType = UtilityType_baseTypeOf(reader, value_8(typeReferenceNode.typeArguments)[0]);
987
- let literalMembers;
988
- const matchValue_1 = baseType.flags;
989
- let matchResult_1;
990
- if ($007CHasTypeFlags$007C_$007C(1, matchValue_1) != null) {
991
- if (typeReferenceNode.pos < 0) {
992
- matchResult_1 = 0;
993
- }
994
- else {
995
- 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;
996
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]);
997
373
  }
998
374
  else {
999
- matchResult_1 = 1;
375
+ return new GlueType(/* ThisType */ 17, [new GlueThisType(defaultArg(declaredName(typ.symbol), typ.symbol.name), typParameters)]);
1000
376
  }
1001
- switch (matchResult_1) {
1002
- case 0: {
1003
- const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_8(typeReferenceNode.typeArguments)[0]);
1004
- literalMembers = ((matchValue_2.tag === 20) ? matchValue_2.fields[0] : ((matchValue_2.tag === 22) ? matchValue_2.fields[0].Members : undefined));
1005
- 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
+ }
1006
392
  }
1007
- default:
1008
- literalMembers = undefined;
1009
- }
1010
- const members_1 = collect_1((property) => {
1011
- const matchValue_4 = property.declarations;
1012
- if (matchValue_4 == null) {
1013
- throw new Exception(Report_readerError_Z19516DCE("type node", "Missing declarations", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 841));
393
+ else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
394
+ return collect(readResolvedLiterals, toList(typ_1.types));
1014
395
  }
1015
396
  else {
1016
- return map_1((declaration) => readInstantiatedMember(reader, typeReferenceNode, property, declaration), toList(matchValue_4));
1017
- }
1018
- }, toList(filter_1((prop) => !contains_1(prop.name, keysToOmit, {
1019
- Equals: (x, y) => (x === y),
1020
- GetHashCode: (x) => (stringHash(x) | 0),
1021
- }), (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", 816), (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", 816), (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))))))));
1022
- const defaults = defaultTypeArguments(reader, value_8(typeReferenceNode.typeArguments)[0]);
1023
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Omit */ 4, [(members_3 = map_1((glueMember_2) => GlueSubstitution_substituteMember(defaults, glueMember_2), (literalMembers == null) ? members_1 : filter((glueMember_1) => {
1024
- let matchValue_5;
1025
- const glueMember = glueMember_1;
1026
- switch (glueMember.tag) {
1027
- case 0: {
1028
- matchValue_5 = glueMember.fields[0].Name;
1029
- break;
1030
- }
1031
- case 6: {
1032
- matchValue_5 = glueMember.fields[0].Name;
1033
- break;
1034
- }
1035
- case 2: {
1036
- matchValue_5 = glueMember.fields[0].Name;
1037
- break;
1038
- }
1039
- case 3: {
1040
- matchValue_5 = glueMember.fields[0].Name;
1041
- break;
1042
- }
1043
- case 4:
1044
- case 5:
1045
- case 7: {
1046
- matchValue_5 = undefined;
1047
- break;
1048
- }
1049
- default:
1050
- matchValue_5 = glueMember.fields[0].Name;
397
+ return empty();
1051
398
  }
1052
- if (matchValue_5 == null) {
1053
- 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);
1054
404
  }
1055
405
  else {
1056
- return !contains_1(matchValue_5, keysToOmit, {
1057
- Equals: (x_1, y_1) => (x_1 === y_1),
1058
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
1059
- });
406
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue_1)]);
1060
407
  }
1061
- }, literalMembers)), (typeReferenceNode.pos < 0) ? UtilityType_withoutForeignTypeParameters(reader, defaults, members_3) : members_3)])]);
1062
- }
1063
-
1064
- export function UtilityType_readReadonly(reader, typeReferenceNode) {
1065
- const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
1066
- const matchValue = typ.flags;
1067
- let matchResult;
1068
- if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
1069
- matchResult = 0;
1070
- }
1071
- else if ($007CHasTypeFlags$007C_$007C(268435456, matchValue) != null) {
1072
- matchResult = 0;
1073
408
  }
1074
409
  else {
1075
- matchResult = 1;
1076
- }
1077
- switch (matchResult) {
1078
- case 0:
1079
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 5, [new GlueReadonly(/* Members */ 0, [UtilityType_readMembers(reader, typeReferenceNode, typ)])])]);
1080
- default:
1081
- if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
1082
- const unionType = typ;
1083
- try {
1084
- return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 5, [new GlueReadonly(/* Union */ 1, [toList(choose_1((innerType) => {
1085
- let copyOfStruct, Name;
1086
- if ((copyOfStruct = innerType.flags, (copyOfStruct & 1048576) !== 0)) {
1087
- return (Name = (value_8(innerType.aliasTypeArguments)[0]).symbol.name, new GlueInterface(empty(), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getFullyQualifiedName((value_8(innerType.aliasTypeArguments)[0]).symbol), Name, UtilityType_readMembers(reader, typeReferenceNode, innerType), empty(), empty()));
1088
- }
1089
- else {
1090
- return undefined;
1091
- }
1092
- }, unionType.types))])])]);
1093
- }
1094
- catch (matchValue_1) {
1095
- const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 923);
1096
- const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1097
- void (objectArg.push(item));
1098
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1099
- }
1100
- }
1101
- else {
1102
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1103
- }
410
+ return GlueType.TemplateLiteral;
1104
411
  }
1105
412
  }
1106
413
 
1107
414
  export function readTypeNode(reader, typeNode) {
1108
- let option_11, symbol_4, matchValue_14, matchValue_23, option_14, arg_2, symbol_5, symbol_7, symbol_8, symbol_9, matchValue_29, option_21, symbol_11, matchValue_30;
415
+ let constraintNode, typeParameters_1;
1109
416
  const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
1110
417
  const matchValue = typeNode.kind;
1111
418
  switch (matchValue) {
@@ -1117,6 +424,49 @@ export function readTypeNode(reader, typeNode) {
1117
424
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1118
425
  case 136:
1119
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
+ }
1120
470
  case 146:
1121
471
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Never]);
1122
472
  case 150:
@@ -1134,276 +484,18 @@ export function readTypeNode(reader, typeNode) {
1134
484
  case 163:
1135
485
  return new GlueType(/* Primitive */ 3, [GluePrimitive.BigInt$]);
1136
486
  case 183: {
1137
- const matchValue_12 = typeNode.assertsModifier;
1138
- if (matchValue_12 == null) {
487
+ const matchValue_1 = typeNode.assertsModifier;
488
+ if (matchValue_1 == null) {
1139
489
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
1140
490
  }
1141
491
  else {
1142
492
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
1143
493
  }
1144
494
  }
1145
- case 184: {
1146
- const typeReferenceNode = typeNode;
1147
- const symbolOpt = symbolAtLocation(checker, typeReferenceNode.typeName);
1148
- const readTypeReference = (isStandardLibrary) => {
1149
- let symbol_2, matchValue_4, declarations, typNode, option_7, valueDeclaration, matchValue_6, matchValue_7;
1150
- if ((symbolOpt == null) ? false : ((symbol_2 = symbolOpt, (matchValue_4 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(262144, matchValue_4) != null)))) {
1151
- return new GlueType(/* TypeParameter */ 16, [value_8(symbolOpt).name]);
1152
- }
1153
- else {
1154
- let matchValue_5;
1155
- const option_5 = UtilityType_tryExpandAnonymousObjectApplication(reader, typeReferenceNode);
1156
- if (option_5 != null) {
1157
- matchValue_5 = option_5;
1158
- }
1159
- else {
1160
- let isConditionalAlias;
1161
- let matchValue_1;
1162
- const option_1 = symbolOpt;
1163
- matchValue_1 = ((option_1 != null) ? resolveAlias(checker, option_1) : undefined);
1164
- if (matchValue_1 == null) {
1165
- isConditionalAlias = false;
1166
- }
1167
- else {
1168
- const symbol_1 = matchValue_1;
1169
- const matchValue_2 = symbol_1.declarations;
1170
- let matchResult, declarations_1;
1171
- if (matchValue_2 != null) {
1172
- if ((declarations = matchValue_2, declarations.length > 0)) {
1173
- matchResult = 0;
1174
- declarations_1 = matchValue_2;
1175
- }
1176
- else {
1177
- matchResult = 1;
1178
- }
1179
- }
1180
- else {
1181
- matchResult = 1;
1182
- }
1183
- switch (matchResult) {
1184
- case 0: {
1185
- const declaration = item_4(0, declarations_1);
1186
- isConditionalAlias = ((declaration.kind === 266) && (declaration.type.kind === 195));
1187
- break;
1188
- }
1189
- default:
1190
- isConditionalAlias = false;
1191
- }
1192
- }
1193
- if ((typeReferenceNode.pos < 0) ? true : !isConditionalAlias) {
1194
- matchValue_5 = undefined;
1195
- }
1196
- else {
1197
- const typ = checker.getTypeFromTypeNode(typeReferenceNode);
1198
- let isUnknown;
1199
- const matchValue_3 = typ.flags;
1200
- let matchResult_1;
1201
- if ($007CHasTypeFlags$007C_$007C(1, matchValue_3) != null) {
1202
- matchResult_1 = 0;
1203
- }
1204
- else if ($007CHasTypeFlags$007C_$007C(262144, matchValue_3) != null) {
1205
- matchResult_1 = 0;
1206
- }
1207
- else {
1208
- matchResult_1 = 1;
1209
- }
1210
- switch (matchResult_1) {
1211
- case 0: {
1212
- isUnknown = true;
1213
- break;
1214
- }
1215
- default:
1216
- isUnknown = false;
1217
- }
1218
- if (isDeferredConditional(typ) ? true : isUnknown) {
1219
- matchValue_5 = undefined;
1220
- }
1221
- else {
1222
- const flags = 1 | 16384;
1223
- const option_3 = checker.typeToTypeNode(typ, typeReferenceNode, flags);
1224
- matchValue_5 = ((option_3 != null) ? ((typNode = option_3, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode))) : undefined);
1225
- }
1226
- }
1227
- }
1228
- if (matchValue_5 == null) {
1229
- const isQualified = typeReferenceNode.typeName.kind === 167;
1230
- const writtenName = () => {
1231
- if (isQualified) {
1232
- return typeReferenceNode.typeName.right.text;
1233
- }
1234
- else {
1235
- return identifierText(typeReferenceNode.typeName);
1236
- }
1237
- };
1238
- let name;
1239
- if (symbolOpt == null) {
1240
- name = writtenName();
1241
- }
1242
- else {
1243
- const symbol_3 = symbolOpt;
1244
- name = defaultArg(orElse(importedName(checker, symbol_3), (option_7 = symbol_3.valueDeclaration, (option_7 != null) ? ((valueDeclaration = option_7, (matchValue_6 = valueDeclaration.kind, (matchValue_6 === 267) ? (isQualified ? symbol_3.name : writtenName()) : ((matchValue_6 === 307) ? (valueDeclaration.symbol.parent.getName()) : writtenName())))) : undefined)), writtenName());
1245
- }
1246
- const isUnresolved = ((reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && (symbolOpt == null)) && (typeReferenceNode.pos >= 0);
1247
- const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
1248
- if ((((name === "...") ? true : ((matchValue_7 = typeReferenceNode.typeArguments, (matchValue_7 == null) ? false : exists((typeArgument) => {
1249
- if (typeArgument.kind === 184) {
1250
- return typeArgument.typeName.escapedText === "...";
1251
- }
1252
- else {
1253
- return false;
1254
- }
1255
- }, matchValue_7)))) ? true : isUnresolved) ? true : (isExternal && !FSharpSet__Contains(knownExternalTypeNames, name))) {
1256
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1257
- }
1258
- else {
1259
- 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))]);
1260
- }
1261
- }
1262
- else {
1263
- return matchValue_5;
1264
- }
1265
- }
1266
- };
1267
- 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))) {
1268
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_8(typeReferenceNode.typeArguments)[0]);
1269
- }
1270
- else if (isFromEs5Lib(symbolOpt)) {
1271
- const matchValue_11 = getFullNameOrEmpty(checker, typeReferenceNode.typeName);
1272
- switch (matchValue_11) {
1273
- case "Exclude":
1274
- return UtilityType_readExclude(reader, typeReferenceNode);
1275
- case "Uppercase":
1276
- case "Lowercase":
1277
- case "Capitalize":
1278
- case "Uncapitalize": {
1279
- const literals = (typ_1) => {
1280
- const matchValue_8 = typ_1.flags;
1281
- if ($007CHasTypeFlags$007C_$007C(1024, matchValue_8) != null) {
1282
- const activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ_1);
1283
- if (activePatternResult_4.tag === 1) {
1284
- return undefined;
1285
- }
1286
- else {
1287
- return singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_4.fields[0]])]));
1288
- }
1289
- }
1290
- else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_8) != null) {
1291
- return fold((acc, cases) => {
1292
- let matchResult_2, acc_1, cases_1;
1293
- if (acc != null) {
1294
- if (cases != null) {
1295
- matchResult_2 = 0;
1296
- acc_1 = acc;
1297
- cases_1 = cases;
1298
- }
1299
- else {
1300
- matchResult_2 = 1;
1301
- }
1302
- }
1303
- else {
1304
- matchResult_2 = 1;
1305
- }
1306
- switch (matchResult_2) {
1307
- case 0:
1308
- return append_1(acc_1, cases_1);
1309
- default:
1310
- return undefined;
1311
- }
1312
- }, empty(), map_1(literals, toList(typ_1.types)));
1313
- }
1314
- else {
1315
- return undefined;
1316
- }
1317
- };
1318
- if (typeReferenceNode.pos < 0) {
1319
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
1320
- }
1321
- else {
1322
- const matchValue_10 = literals(checker.getTypeFromTypeNode(typeReferenceNode));
1323
- let matchResult_3, single, cases_2;
1324
- if (matchValue_10 != null) {
1325
- if (!isEmpty(matchValue_10)) {
1326
- if (isEmpty(tail(matchValue_10))) {
1327
- matchResult_3 = 0;
1328
- single = head(matchValue_10);
1329
- }
1330
- else {
1331
- matchResult_3 = 1;
1332
- cases_2 = matchValue_10;
1333
- }
1334
- }
1335
- else {
1336
- matchResult_3 = 2;
1337
- }
1338
- }
1339
- else {
1340
- matchResult_3 = 2;
1341
- }
1342
- switch (matchResult_3) {
1343
- case 0:
1344
- return single;
1345
- case 1:
1346
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(cases_2)]);
1347
- default:
1348
- return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
1349
- }
1350
- }
1351
- }
1352
- case "Partial":
1353
- return UtilityType_readPartial(reader, typeReferenceNode);
1354
- case "Record":
1355
- return UtilityType_readRecord(reader, typeReferenceNode);
1356
- case "ReturnType":
1357
- return UtilityType_readReturnType(reader, typeReferenceNode);
1358
- case "ThisParameterType":
1359
- return UtilityType_readThisParameterType(reader, typeReferenceNode);
1360
- case "Omit":
1361
- return UtilityType_readOmit(reader, typeReferenceNode);
1362
- case "Readonly":
1363
- return UtilityType_readReadonly(reader, typeReferenceNode);
1364
- default:
1365
- return readTypeReference(true);
1366
- }
1367
- }
1368
- else {
1369
- return readTypeReference(isFromEsLib(symbolOpt));
1370
- }
1371
- }
1372
- case 185: {
1373
- const functionTypeNode = typeNode;
1374
- let typeParameters;
1375
- const collectEnclosing = (node_mut, acc_2_mut) => {
1376
- collectEnclosing:
1377
- while (true) {
1378
- const node = node_mut, acc_2 = acc_2_mut;
1379
- if (Operators_IsNull(node)) {
1380
- return acc_2;
1381
- }
1382
- 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"]()))) {
1383
- node_mut = value_8(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]());
1384
- acc_2_mut = acc_2;
1385
- continue collectEnclosing;
1386
- }
1387
- else if (node.kind === 169) {
1388
- return empty();
1389
- }
1390
- else {
1391
- const ownTypeParameters = node.typeParameters;
1392
- const acc_3 = (ownTypeParameters == null) ? acc_2 : append_1(acc_2, toList(ownTypeParameters));
1393
- node_mut = node.parent;
1394
- acc_2_mut = acc_3;
1395
- continue collectEnclosing;
1396
- }
1397
- break;
1398
- }
1399
- };
1400
- const matchValue_13 = List_distinctBy((typeParameter) => identifierText(typeParameter.name), collectEnclosing(functionTypeNode, empty()), {
1401
- Equals: (x, y) => (x === y),
1402
- GetHashCode: (x) => (stringHash(x) | 0),
1403
- });
1404
- typeParameters = (isEmpty(matchValue_13) ? empty() : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"]((ts.factory).createNodeArray(Array.from(matchValue_13))));
1405
- 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_14 = functionTypeNode.typeParameters, (matchValue_14 == null) ? empty() : toList(map((typeParameter_1) => identifierText(typeParameter_1.name), matchValue_14))), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](functionTypeNode.parameters))]);
1406
- }
495
+ case 184:
496
+ return readTypeReference(reader, typeNode);
497
+ case 185:
498
+ return readFunctionType(reader, typeNode);
1407
499
  case 186: {
1408
500
  const constructorTypeNode = typeNode;
1409
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))]);
@@ -1412,7 +504,7 @@ export function readTypeNode(reader, typeNode) {
1412
504
  return readTypeQueryNode(reader, typeNode);
1413
505
  case 188: {
1414
506
  const typeLiteralNode = typeNode;
1415
- return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(map_1((declaration_7) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_7), toList(typeLiteralNode.members)), typeLiteralId(typeLiteralNode))]);
507
+ return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(map((declaration) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration), toList(typeLiteralNode.members)), typeLiteralId(typeLiteralNode))]);
1416
508
  }
1417
509
  case 189: {
1418
510
  const arrayTypeNode = typeNode;
@@ -1420,13 +512,13 @@ export function readTypeNode(reader, typeNode) {
1420
512
  }
1421
513
  case 190: {
1422
514
  const tupleTypeNode = typeNode;
1423
- const elements = map_1((value_4) => value_4, toList(tupleTypeNode.elements));
515
+ const elements = map((value) => value, toList(tupleTypeNode.elements));
1424
516
  if (exists_1((element) => (element.kind === 192), elements)) {
1425
- const elementTypes = List_distinct(map_1((element_1) => {
517
+ const elementTypes = List_distinct(map((element_1) => {
1426
518
  if (element_1.kind === 192) {
1427
- const matchValue_21 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type);
1428
- if (matchValue_21.tag === 14) {
1429
- return matchValue_21.fields[0];
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];
1430
522
  }
1431
523
  else {
1432
524
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -1437,22 +529,22 @@ export function readTypeNode(reader, typeNode) {
1437
529
  }
1438
530
  }, elements), {
1439
531
  Equals: equals,
1440
- GetHashCode: (x_3) => (safeHash(x_3) | 0),
532
+ GetHashCode: (x) => (safeHash(x) | 0),
1441
533
  });
1442
- let matchResult_4, elementType_2;
534
+ let matchResult_2, elementType_2;
1443
535
  if (!isEmpty(elementTypes)) {
1444
536
  if (isEmpty(tail(elementTypes))) {
1445
- matchResult_4 = 0;
537
+ matchResult_2 = 0;
1446
538
  elementType_2 = head(elementTypes);
1447
539
  }
1448
540
  else {
1449
- matchResult_4 = 1;
541
+ matchResult_2 = 1;
1450
542
  }
1451
543
  }
1452
544
  else {
1453
- matchResult_4 = 1;
545
+ matchResult_2 = 1;
1454
546
  }
1455
- switch (matchResult_4) {
547
+ switch (matchResult_2) {
1456
548
  case 0:
1457
549
  return new GlueType(/* Array */ 14, [elementType_2]);
1458
550
  default:
@@ -1460,7 +552,7 @@ export function readTypeNode(reader, typeNode) {
1460
552
  }
1461
553
  }
1462
554
  else {
1463
- 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)]);
1464
556
  }
1465
557
  }
1466
558
  case 191: {
@@ -1472,224 +564,44 @@ export function readTypeNode(reader, typeNode) {
1472
564
  case 193:
1473
565
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadUnionTypeNodeZ5A082EC2"](typeNode);
1474
566
  case 194:
1475
- if (exists((inProgress) => (inProgress === checker.getTypeAtLocation(typeNode)), intersectionsInProgress)) {
567
+ if (exists((inProgress) => (inProgress === checker.getTypeAtLocation(typeNode)), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections)) {
1476
568
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1477
569
  }
1478
570
  else if (exists(isGlobalThisQuery, typeNode.types)) {
1479
- const matchValue_22 = toList(filter_1((arg_3) => !isGlobalThisQuery(arg_3), typeNode.types));
1480
- let matchResult_5, single_1;
1481
- if (!isEmpty(matchValue_22)) {
1482
- if (isEmpty(tail(matchValue_22))) {
1483
- matchResult_5 = 0;
1484
- single_1 = head(matchValue_22);
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);
1485
577
  }
1486
578
  else {
1487
- matchResult_5 = 1;
579
+ matchResult_3 = 1;
1488
580
  }
1489
581
  }
1490
582
  else {
1491
- matchResult_5 = 1;
583
+ matchResult_3 = 1;
1492
584
  }
1493
- switch (matchResult_5) {
585
+ switch (matchResult_3) {
1494
586
  case 0:
1495
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single_1);
587
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
1496
588
  default:
1497
589
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1498
590
  }
1499
591
  }
1500
592
  else {
1501
- const intersectionTypeNode = typeNode;
1502
- const unionOrIntersectionType = checker.getTypeAtLocation(intersectionTypeNode);
1503
- void (intersectionsInProgress.push(unionOrIntersectionType));
1504
- const _guard = {
1505
- Dispose() {
1506
- intersectionsInProgress.splice(intersectionsInProgress.length - 1, 1);
1507
- },
1508
- };
1509
- try {
1510
- const properties_1 = choose((property_1) => {
1511
- const matchValue_24 = property_1.declarations;
1512
- if (matchValue_24 == null) {
1513
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
1514
- }
1515
- else {
1516
- const declarations_3 = matchValue_24;
1517
- if (declarations_3.length === 1) {
1518
- return new IntersectionTypePropertyResult(/* Single */ 0, [property_1, item_4(0, declarations_3)]);
1519
- }
1520
- else if (forAll((declaration_2) => {
1521
- if (declaration_2.kind === 172) {
1522
- return true;
1523
- }
1524
- else {
1525
- return declaration_2.kind === 173;
1526
- }
1527
- }, declarations_3)) {
1528
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
1529
- }
1530
- else {
1531
- return IntersectionTypePropertyResult.ForceAny;
1532
- }
1533
- }
1534
- }, unionOrIntersectionType.isUnion() ? List_distinct(concat_2(map_1((arg_4) => toList(checker.getPropertiesOfType(arg_4)), toList(unionOrIntersectionType.types))), {
1535
- Equals: equals,
1536
- GetHashCode: (x_4) => (structuralHash(x_4) | 0),
1537
- }) : ((matchValue_23 = toList(unionOrIntersectionType.getProperties()), isEmpty(matchValue_23) ? ((intersectionTypeNode.pos >= 0) ? List_distinctBy((property) => property.name, collect_1((constituent) => {
1538
- let type_1;
1539
- return toList((type_1 = checker.getTypeAtLocation(constituent), checker.getPropertiesOfType(type_1)));
1540
- }, toList(intersectionTypeNode.types)), {
1541
- Equals: (x_5, y_5) => (x_5 === y_5),
1542
- GetHashCode: (x_5) => (stringHash(x_5) | 0),
1543
- }) : matchValue_23) : matchValue_23)));
1544
- const hasUnsupportedProperties = exists_1((property_2) => {
1545
- switch (property_2.tag) {
1546
- case 1:
1547
- return false;
1548
- case 0:
1549
- if (property_2.fields[1].kind === 175) {
1550
- return true;
1551
- }
1552
- else {
1553
- return false;
1554
- }
1555
- default:
1556
- return true;
1557
- }
1558
- }, properties_1);
1559
- const callSignatures = unionOrIntersectionType.isUnion() ? empty() : choose((signature) => {
1560
- const flags_1 = 1 | 16384;
1561
- const synthesized = checker.signatureToSignatureDeclaration(signature, 180, typeNode, flags_1);
1562
- if (synthesized == null) {
1563
- return undefined;
1564
- }
1565
- else {
1566
- const declaration_4 = synthesized;
1567
- declaration_4.parent = typeNode;
1568
- const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
1569
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_4);
1570
- try {
1571
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_4);
1572
- }
1573
- finally {
1574
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
1575
- }
1576
- }
1577
- }, toList(checker.getSignaturesOfType(unionOrIntersectionType, 0)));
1578
- if (hasUnsupportedProperties) {
1579
- const references = map_1((constituent_1) => {
1580
- if (constituent_1.kind === 184) {
1581
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_1);
1582
- }
1583
- else {
1584
- return GlueType.Discard;
1585
- }
1586
- }, toList(intersectionTypeNode.types));
1587
- return (!isEmpty(references) && forAll_1((_arg) => {
1588
- if (_arg.tag === 13) {
1589
- return true;
1590
- }
1591
- else {
1592
- return false;
1593
- }
1594
- }, references)) ? (new GlueType(/* IntersectionOfReferences */ 21, [references])) : (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
1595
- }
1596
- else {
1597
- return new GlueType(/* IntersectionType */ 20, [append_1(choose((_arg_1) => {
1598
- switch (_arg_1.tag) {
1599
- case 1:
1600
- return readPropertyWithoutDeclaration(reader, typeNode, _arg_1.fields[0]);
1601
- case 2:
1602
- throw new Exception("Sould not happen here");
1603
- default:
1604
- return readInstantiatedMember(reader, typeNode, _arg_1.fields[0], _arg_1.fields[1]);
1605
- }
1606
- }, properties_1), append_1(callSignatures, collect_1((constituent_2) => {
1607
- if (constituent_2.kind === 188) {
1608
- return map_1((declaration_6) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_6), filter((element_2) => (element_2.kind === 182), toList(constituent_2.members)));
1609
- }
1610
- else {
1611
- return empty();
1612
- }
1613
- }, toList(intersectionTypeNode.types))))]);
1614
- }
1615
- }
1616
- finally {
1617
- disposeSafe(_guard);
1618
- }
1619
- }
1620
- case 195: {
1621
- const conditionalTypeNode = typeNode;
1622
- const typ_4 = checker.getTypeAtLocation(conditionalTypeNode);
1623
- if (isDeferredConditional(typ_4)) {
1624
- const warningsCount = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length | 0;
1625
- const inferred = ofList(map_1((inferTypeNode) => [inferTypeNode.typeParameter.name.getText(), inferredConstraint(reader, inferTypeNode)], inferTypeNodes(conditionalTypeNode.extendsType)), {
1626
- Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
1627
- });
1628
- 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));
1629
- if (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length > warningsCount) {
1630
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().splice(warningsCount, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().length - warningsCount);
1631
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1632
- }
1633
- else {
1634
- return new GlueType(/* ConditionalType */ 33, [conditionalType]);
1635
- }
1636
- }
1637
- else {
1638
- const matchValue_31 = readTypeUsingFlags(reader, typ_4);
1639
- let matchResult_6, forward;
1640
- if (matchValue_31.tag === 3) {
1641
- if (matchValue_31.fields[0].tag === 6) {
1642
- matchResult_6 = 0;
1643
- }
1644
- else {
1645
- matchResult_6 = 1;
1646
- forward = matchValue_31;
1647
- }
1648
- }
1649
- else {
1650
- matchResult_6 = 1;
1651
- forward = matchValue_31;
1652
- }
1653
- switch (matchResult_6) {
1654
- case 0:
1655
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](conditionalTypeNode.checkType);
1656
- default:
1657
- return forward;
1658
- }
593
+ return readIntersectionType(reader, typeNode);
1659
594
  }
1660
- }
595
+ case 195:
596
+ return readConditionalType(reader, typeNode);
1661
597
  case 196:
1662
- return inferredConstraint(reader, typeNode);
598
+ return new GlueType(/* TypeParameter */ 16, [typeNode.typeParameter.name.getText()]);
1663
599
  case 197: {
1664
600
  const parenthesizedTypeNode = typeNode;
1665
601
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](parenthesizedTypeNode.type);
1666
602
  }
1667
- case 198: {
1668
- const thisTypeNode = typeNode;
1669
- const typ_2 = checker.getTypeAtLocation(thisTypeNode);
1670
- let typParameters_1;
1671
- const matchValue_19 = Operators_IsNull(typ_2.symbol) ? undefined : typ_2.symbol.declarations;
1672
- typParameters_1 = ((matchValue_19 == null) ? empty() : defaultArg((option_14 = tryHead(sortByDescending((typeParameters_1) => (~~typeParameters_1.length | 0), choose_1((declaration_1) => {
1673
- const matchValue_20 = declaration_1.kind;
1674
- switch (matchValue_20) {
1675
- case 264:
1676
- case 265: {
1677
- const classDeclaration = declaration_1;
1678
- return classDeclaration.typeParameters;
1679
- }
1680
- default:
1681
- return undefined;
1682
- }
1683
- }, matchValue_19), {
1684
- Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
1685
- })), (option_14 != null) ? ((arg_2 = option_14, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](arg_2))) : undefined), empty()));
1686
- if (Operators_IsNull(typ_2.symbol)) {
1687
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1688
- }
1689
- else {
1690
- return new GlueType(/* ThisType */ 17, [new GlueThisType(defaultArg(declaredName(typ_2.symbol), typ_2.symbol.name), typParameters_1)]);
1691
- }
1692
- }
603
+ case 198:
604
+ return readThisType(reader, typeNode);
1693
605
  case 199: {
1694
606
  const typeOperatorNode = typeNode;
1695
607
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode);
@@ -1702,130 +614,24 @@ export function readTypeNode(reader, typeNode) {
1702
614
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadMappedTypeNode28272C00"](typeNode);
1703
615
  case 202: {
1704
616
  const literalTypeNode = typeNode;
1705
- const matchValue_18 = tryReadLiteral(checker, literalTypeNode.literal);
1706
- if (matchValue_18 == null) {
1707
- throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1276));
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));
1708
620
  }
1709
621
  else {
1710
- return new GlueType(/* Literal */ 8, [matchValue_18]);
622
+ return new GlueType(/* Literal */ 8, [matchValue_2]);
1711
623
  }
1712
624
  }
1713
625
  case 203:
1714
626
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNamedTupleMemberZ6E17C942"](typeNode);
1715
- case 204: {
1716
- const templateLiteralTypeNode = typeNode;
1717
- const readResolvedLiterals = (typ_6) => {
1718
- const matchValue_32 = typ_6.flags;
1719
- if ($007CHasTypeFlags$007C_$007C(1024, matchValue_32) != null) {
1720
- const activePatternResult_7 = Type_StringLiteral_$007CString$007COther$007C(typ_6);
1721
- if (activePatternResult_7.tag === 1) {
1722
- return empty();
1723
- }
1724
- else {
1725
- return singleton_1(new GlueType(/* Literal */ 8, [new GlueLiteral(/* String */ 0, [activePatternResult_7.fields[0]])]));
1726
- }
1727
- }
1728
- else if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_32) != null) {
1729
- return collect_1(readResolvedLiterals, toList(typ_6.types));
1730
- }
1731
- else {
1732
- return empty();
1733
- }
1734
- };
1735
- const matchValue_33 = readResolvedLiterals(checker.getTypeAtLocation(templateLiteralTypeNode));
1736
- if (!isEmpty(matchValue_33)) {
1737
- if (isEmpty(tail(matchValue_33))) {
1738
- return head(matchValue_33);
1739
- }
1740
- else {
1741
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue_33)]);
1742
- }
1743
- }
1744
- else {
1745
- return GlueType.TemplateLiteral;
1746
- }
1747
- }
1748
- case 206: {
1749
- const importTypeNode = typeNode;
1750
- let unresolvedModule;
1751
- if (importTypeNode.pos < 0) {
1752
- unresolvedModule = undefined;
1753
- }
1754
- else if (importTypeNode.argument.kind === 202) {
1755
- const literal = importTypeNode.argument.literal;
1756
- unresolvedModule = ((symbolAtLocation(checker, literal) != null) ? undefined : literal.text);
1757
- }
1758
- else {
1759
- unresolvedModule = undefined;
1760
- }
1761
- const matchValue_16 = importTypeNode.qualifier;
1762
- if (unresolvedModule == null) {
1763
- if (matchValue_16 == null) {
1764
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1765
- }
1766
- else if (importTypeNode.isTypeOf) {
1767
- const qualifier_1 = matchValue_16;
1768
- const typNode_1 = (ts.factory).createTypeQueryNode(qualifier_1);
1769
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_1);
1770
- }
1771
- else {
1772
- const qualifier_2 = matchValue_16;
1773
- const typNode_2 = (ts.factory).createTypeReferenceNode(qualifier_2, unwrap(importTypeNode.typeArguments));
1774
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_2);
1775
- }
1776
- }
1777
- else {
1778
- const moduleName = unresolvedModule;
1779
- const warning = concat("\'", moduleName, "\' is not installed, the types imported from it are generated as \'obj\'");
1780
- if (!contains_2(warning, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), {
1781
- Equals: (x_1, y_1) => (x_1 === y_1),
1782
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
1783
- })) {
1784
- void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
1785
- }
1786
- return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
1787
- }
1788
- }
1789
- case 234: {
1790
- const expression = typeNode;
1791
- const typ_3 = checker.getTypeFromTypeNode(expression);
1792
- const symbolOpt_1 = orElse(orElse(typ_3.aliasSymbol, Operators_IsNull(typ_3.symbol) ? undefined : typ_3.symbol), checker.getSymbolAtLocation(expression.expression));
1793
- const matchValue_26 = isFromEs5Lib(symbolOpt_1);
1794
- const matchValue_27 = getFullNameOrEmpty(checker, expression.expression);
1795
- let matchResult_7;
1796
- if (matchValue_26) {
1797
- if (matchValue_27 === "Omit") {
1798
- matchResult_7 = 0;
1799
- }
1800
- else {
1801
- matchResult_7 = 1;
1802
- }
1803
- }
1804
- else {
1805
- matchResult_7 = 1;
1806
- }
1807
- switch (matchResult_7) {
1808
- case 0:
1809
- return UtilityType_readOmit(reader, expression);
1810
- default: {
1811
- const isQualified_1 = expression.expression.kind === 212;
1812
- 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());
1813
- const isExternal_1 = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt_1);
1814
- 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")))) {
1815
- return GlueType.Discard;
1816
- }
1817
- else {
1818
- return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name_1.indexOf(".") >= 0) ? name_1 : sanitizeTypeName(name_1), (matchValue_29 = ((option_21 = symbolOpt_1, (option_21 != null) ? resolveAlias(checker, option_21) : undefined)), (matchValue_29 == null) ? getFullNameOrEmpty(checker, expression.expression) : ((symbol_11 = matchValue_29, checker.getFullyQualifiedName(symbol_11)))), isLibraryName(reader, name_1) ? empty() : modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), isQualified_1, symbolOpt_1), (matchValue_30 = readTypeArguments(reader, expression), isEmpty(matchValue_30) ? map_1((argument) => {
1819
- const flags_2 = 1 | 16384;
1820
- const typNode_4 = checker.typeToTypeNode(argument, undefined, flags_2);
1821
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode_4);
1822
- }, resolvedBaseTypeArguments(checker, expression)) : matchValue_30), (isFromEs5Lib(symbolOpt_1) ? true : isExternal_1) ? true : isLibraryName(reader, name_1))]);
1823
- }
1824
- }
1825
- }
1826
- }
627
+ case 204:
628
+ return readTemplateLiteralType(reader, typeNode);
629
+ case 206:
630
+ return readImportType(reader, typeNode);
631
+ case 234:
632
+ return readExpressionWithTypeArguments(reader, typeNode);
1827
633
  default: {
1828
- 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", 1766);
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);
1829
635
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1830
636
  void (objectArg.push(item));
1831
637
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);