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