@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.7

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.
@@ -2,7 +2,7 @@
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
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";
5
+ import { tryReadLiteral, resolvedBaseTypeArguments, resolveValueAlias, 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";
6
6
  import { Report_readerError_Z19516DCE } from "./Report.js";
7
7
  import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
8
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";
@@ -956,8 +956,18 @@ export function UtilityType_readExclude(reader, typeReferenceNode) {
956
956
  else if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
957
957
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
958
958
  }
959
+ else if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
960
+ const matchValue_15 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
961
+ if (matchValue_15 == null) {
962
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
963
+ }
964
+ else {
965
+ const typeNode_3 = matchValue_15;
966
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode_3);
967
+ }
968
+ }
959
969
  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);
970
+ 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", 799);
961
971
  const objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
962
972
  void (objectArg_3.push(item_3));
963
973
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -1278,7 +1288,7 @@ function UtilityType_withoutForeignTypeParameters(reader, bound, members) {
1278
1288
  export function UtilityType_readPartial(reader, typeReferenceNode) {
1279
1289
  const baseType = UtilityType_baseTypeOf(reader, value_6(typeReferenceNode.typeArguments)[0]);
1280
1290
  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);
1291
+ const item = Report_readerError_Z19516DCE("Partial", "Recursive Partial is not supported, defaulting to obj", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1045);
1282
1292
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1283
1293
  void (objectArg.push(item));
1284
1294
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -1331,7 +1341,7 @@ export function UtilityType_readPartial(reader, typeReferenceNode) {
1331
1341
  }
1332
1342
  default:
1333
1343
  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);
1344
+ 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", 1087);
1335
1345
  const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1336
1346
  void (objectArg_1.push(item_1));
1337
1347
  members = empty();
@@ -1386,7 +1396,7 @@ export function UtilityType_readReturnType(reader, typeReferenceNode) {
1386
1396
  default:
1387
1397
  typ = rawTyp;
1388
1398
  }
1389
- const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, undefined);
1399
+ const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
1390
1400
  if (matchValue_3 == null) {
1391
1401
  return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ReturnType */ 2, [readTypeUsingFlags(reader, typ)])]);
1392
1402
  }
@@ -1398,7 +1408,7 @@ export function UtilityType_readReturnType(reader, typeReferenceNode) {
1398
1408
 
1399
1409
  export function UtilityType_readThisParameterType(reader, typeReferenceNode) {
1400
1410
  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);
1411
+ const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
1402
1412
  if (matchValue == null) {
1403
1413
  return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* ThisParameterType */ 3, [readTypeUsingFlags(reader, typ)])]);
1404
1414
  }
@@ -1440,7 +1450,7 @@ export function UtilityType_readOmitOrPick(reader, typeReferenceNode, keepListed
1440
1450
  const tryReadValueOfKeys = (typ) => {
1441
1451
  const activePatternResult_3 = Type_StringLiteral_$007CString$007COther$007C(typ);
1442
1452
  if (activePatternResult_3.tag === 1) {
1443
- const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1204);
1453
+ const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1209);
1444
1454
  const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1445
1455
  void (objectArg_1.push(item));
1446
1456
  return undefined;
@@ -1505,7 +1515,7 @@ export function UtilityType_readOmitOrPick(reader, typeReferenceNode, keepListed
1505
1515
  const filteredProperties = toList(filter((prop) => (keepListedKeys === contains_1(prop.name, keysToOmit, {
1506
1516
  Equals: (x, y) => (x === y),
1507
1517
  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)))))));
1518
+ })), (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", 1244), (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", 1244), (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
1519
  const isInProgress = exists((inProgress) => (inProgress === baseType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions);
1510
1520
  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
1521
  const defaults = defaultTypeArguments(reader, value_6(typeReferenceNode.typeArguments)[0]);
@@ -1597,7 +1607,7 @@ export function UtilityType_readReadonly(reader, typeReferenceNode) {
1597
1607
  }, unionType.types))])])]);
1598
1608
  }
1599
1609
  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);
1610
+ const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 1368);
1601
1611
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
1602
1612
  void (objectArg.push(item));
1603
1613
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -2168,7 +2178,7 @@ function readExpressionWithTypeArguments(reader, typeNode) {
2168
2178
  return GlueType.Discard;
2169
2179
  }
2170
2180
  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) => {
2181
+ return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name.indexOf(".") >= 0) ? name : sanitizeTypeName(name), (matchValue_2 = ((option_4 = symbolOpt, (option_4 != null) ? resolveValueAlias(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
2182
  const typNode = checker.typeToTypeNode(argument, undefined, typeNodeBuilderFlags);
2173
2183
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
2174
2184
  }, isEmpty(ofAlias) ? resolvedBaseTypeArguments(checker, expression) : ofAlias))) : matchValue_3), (isFromEs5 ? true : isExternal) ? true : isLibraryName(reader, name))]);
@@ -2295,6 +2305,7 @@ function readTemplateLiteralType(reader, typeNode) {
2295
2305
  }
2296
2306
 
2297
2307
  export function readTypeNode(reader, typeNode) {
2308
+ let constraintNode, typeParameters_1;
2298
2309
  const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
2299
2310
  const matchValue = typeNode.kind;
2300
2311
  switch (matchValue) {
@@ -2306,6 +2317,49 @@ export function readTypeNode(reader, typeNode) {
2306
2317
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
2307
2318
  case 136:
2308
2319
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
2320
+ case 141: {
2321
+ const typeParameters = Operators_IsNull(typeNode.parent) ? undefined : typeNode.parent.typeParameters;
2322
+ let matchResult, typeParameters_2;
2323
+ if (typeParameters != null) {
2324
+ if ((typeParameters_1 = typeParameters, ~~typeParameters_1.length === 1)) {
2325
+ matchResult = 0;
2326
+ typeParameters_2 = typeParameters;
2327
+ }
2328
+ else {
2329
+ matchResult = 1;
2330
+ }
2331
+ }
2332
+ else {
2333
+ matchResult = 1;
2334
+ }
2335
+ switch (matchResult) {
2336
+ case 0: {
2337
+ const typeParameter = typeParameters_2[0];
2338
+ const matchValue_5 = typeParameter.constraint;
2339
+ let matchResult_1, constraintNode_1;
2340
+ if (matchValue_5 != null) {
2341
+ if ((constraintNode = matchValue_5, constraintNode.kind === 154)) {
2342
+ matchResult_1 = 0;
2343
+ constraintNode_1 = matchValue_5;
2344
+ }
2345
+ else {
2346
+ matchResult_1 = 1;
2347
+ }
2348
+ }
2349
+ else {
2350
+ matchResult_1 = 1;
2351
+ }
2352
+ switch (matchResult_1) {
2353
+ case 0:
2354
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
2355
+ default:
2356
+ return new GlueType(/* TypeParameter */ 16, [identifierText(typeParameter.name)]);
2357
+ }
2358
+ }
2359
+ default:
2360
+ return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
2361
+ }
2362
+ }
2309
2363
  case 146:
2310
2364
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Never]);
2311
2365
  case 150:
@@ -2370,20 +2424,20 @@ export function readTypeNode(reader, typeNode) {
2370
2424
  Equals: equals,
2371
2425
  GetHashCode: (x) => (safeHash(x) | 0),
2372
2426
  });
2373
- let matchResult, elementType_2;
2427
+ let matchResult_2, elementType_2;
2374
2428
  if (!isEmpty(elementTypes)) {
2375
2429
  if (isEmpty(tail(elementTypes))) {
2376
- matchResult = 0;
2430
+ matchResult_2 = 0;
2377
2431
  elementType_2 = head(elementTypes);
2378
2432
  }
2379
2433
  else {
2380
- matchResult = 1;
2434
+ matchResult_2 = 1;
2381
2435
  }
2382
2436
  }
2383
2437
  else {
2384
- matchResult = 1;
2438
+ matchResult_2 = 1;
2385
2439
  }
2386
- switch (matchResult) {
2440
+ switch (matchResult_2) {
2387
2441
  case 0:
2388
2442
  return new GlueType(/* Array */ 14, [elementType_2]);
2389
2443
  default:
@@ -2408,20 +2462,20 @@ export function readTypeNode(reader, typeNode) {
2408
2462
  }
2409
2463
  else if (exists(isGlobalThisQuery, typeNode.types)) {
2410
2464
  const matchValue_4 = toList(filter((arg) => !isGlobalThisQuery(arg), typeNode.types));
2411
- let matchResult_1, single;
2465
+ let matchResult_3, single;
2412
2466
  if (!isEmpty(matchValue_4)) {
2413
2467
  if (isEmpty(tail(matchValue_4))) {
2414
- matchResult_1 = 0;
2468
+ matchResult_3 = 0;
2415
2469
  single = head(matchValue_4);
2416
2470
  }
2417
2471
  else {
2418
- matchResult_1 = 1;
2472
+ matchResult_3 = 1;
2419
2473
  }
2420
2474
  }
2421
2475
  else {
2422
- matchResult_1 = 1;
2476
+ matchResult_3 = 1;
2423
2477
  }
2424
- switch (matchResult_1) {
2478
+ switch (matchResult_3) {
2425
2479
  case 0:
2426
2480
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
2427
2481
  default:
@@ -2455,7 +2509,7 @@ export function readTypeNode(reader, typeNode) {
2455
2509
  const literalTypeNode = typeNode;
2456
2510
  const matchValue_2 = tryReadLiteral(checker, literalTypeNode.literal);
2457
2511
  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));
2512
+ throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 2243));
2459
2513
  }
2460
2514
  else {
2461
2515
  return new GlueType(/* Literal */ 8, [matchValue_2]);
@@ -2470,7 +2524,7 @@ export function readTypeNode(reader, typeNode) {
2470
2524
  case 234:
2471
2525
  return readExpressionWithTypeArguments(reader, typeNode);
2472
2526
  default: {
2473
- const item = Report_readerError_Z19516DCE("type node", concat("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(typeNode.kind)), typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 2364);
2527
+ 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", 2387);
2474
2528
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
2475
2529
  void (objectArg.push(item));
2476
2530
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -17,30 +17,64 @@ export function readTypeOperatorNode(reader, node) {
17
17
  switch (matchValue) {
18
18
  case 143: {
19
19
  const operandNode = removeParenthesizedType(node.type);
20
+ const arrayKeys = new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$])]))]);
20
21
  const matchValue_1 = operandNode.kind;
22
+ let matchResult;
21
23
  switch (matchValue_1) {
22
- case 133:
23
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Symbol$])]))]);
24
+ case 133: {
25
+ matchResult = 3;
26
+ break;
27
+ }
24
28
  case 184: {
29
+ matchResult = 0;
30
+ break;
31
+ }
32
+ case 187: {
33
+ matchResult = 1;
34
+ break;
35
+ }
36
+ case 189: {
37
+ matchResult = 4;
38
+ break;
39
+ }
40
+ case 194:
41
+ case 200: {
42
+ matchResult = 2;
43
+ break;
44
+ }
45
+ case 199: {
46
+ if (operandNode.type.kind === 189) {
47
+ matchResult = 5;
48
+ }
49
+ else {
50
+ matchResult = 6;
51
+ }
52
+ break;
53
+ }
54
+ default:
55
+ matchResult = 6;
56
+ }
57
+ switch (matchResult) {
58
+ case 0: {
25
59
  const typeReferenceNode = operandNode;
26
60
  const symbolOpt = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
27
61
  if (symbolOpt != null) {
28
62
  const symbol = symbolOpt;
29
63
  const matchValue_2 = symbol.declarations;
30
- let matchResult, declarations_1;
64
+ let matchResult_1, declarations_1;
31
65
  if (matchValue_2 != null) {
32
66
  if ((declarations = matchValue_2, declarations.length > 0)) {
33
- matchResult = 0;
67
+ matchResult_1 = 0;
34
68
  declarations_1 = matchValue_2;
35
69
  }
36
70
  else {
37
- matchResult = 1;
71
+ matchResult_1 = 1;
38
72
  }
39
73
  }
40
74
  else {
41
- matchResult = 1;
75
+ matchResult_1 = 1;
42
76
  }
43
- switch (matchResult) {
77
+ switch (matchResult_1) {
44
78
  case 0: {
45
79
  const declaration_1 = defaultArg(tryFind((declaration) => (declaration.kind === 264), declarations_1), item_2(0, declarations_1));
46
80
  if (declaration_1.kind === 169) {
@@ -57,23 +91,28 @@ export function readTypeOperatorNode(reader, node) {
57
91
  }
58
92
  }
59
93
  default:
60
- throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing declarations", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 52));
94
+ throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing declarations", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 61));
61
95
  }
62
96
  }
63
97
  else if (node.pos < 0) {
64
98
  return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
65
99
  }
66
100
  else {
67
- throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing symbol", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 28));
101
+ throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing symbol", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 37));
68
102
  }
69
103
  }
70
- case 187:
104
+ case 1:
71
105
  return new GlueType(/* KeyOf */ 9, [readTypeQueryNode(reader, operandNode)]);
72
- case 194:
73
- case 200:
106
+ case 2:
74
107
  return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
108
+ case 3:
109
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Symbol$])]))]);
110
+ case 4:
111
+ return arrayKeys;
112
+ case 5:
113
+ return arrayKeys;
75
114
  default: {
76
- const item = Report_readerError_Z19516DCE("type operator (keyof)", concat("Was expecting a type reference or a type query instead got a Node of type ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(operandNode.kind)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 75);
115
+ const item = Report_readerError_Z19516DCE("type operator (keyof)", concat("Was expecting a type reference or a type query instead got a Node of type ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(operandNode.kind)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 91);
77
116
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
78
117
  void (objectArg.push(item));
79
118
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -85,7 +124,7 @@ export function readTypeOperatorNode(reader, node) {
85
124
  case 158:
86
125
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type);
87
126
  default: {
88
- const item_1 = Report_readerError_Z19516DCE("type operator", concat("Unsupported operator ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(node.operator)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 89);
127
+ const item_1 = Report_readerError_Z19516DCE("type operator", concat("Unsupported operator ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(node.operator)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 105);
89
128
  const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
90
129
  void (objectArg_1.push(item_1));
91
130
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -152,6 +152,11 @@ export function PackageContext__TryFindExternalModulePath_Z55EFCE8F(this$, fileN
152
152
  }, this$.Externals);
153
153
  }
154
154
 
155
+ export function PackageContext__IsExternalLibFile_Z721C83C5(this$, fileName) {
156
+ const fileName_1 = normalizePath(fileName);
157
+ return exists((external) => exists((prefix) => (fileName_1.indexOf(prefix) >= 0), external.LibFilePrefixes), this$.Externals);
158
+ }
159
+
155
160
  export function PackageContext__IsExternal_Z721C83C5(this$, fileName) {
156
161
  if (PackageContext__TryFindPackage_Z721C83C5(this$, fileName) == null) {
157
162
  return PackageContext__TryFindExternalModulePath_Z721C83C5(this$, fileName) == null;
@@ -9,7 +9,7 @@ import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FS
9
9
  import { withoutDeclarationExtension, normalizePath } from "../Utils/String.js";
10
10
  import { class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
11
11
  import { tryPick, map as map_2, last, iterate, toList, tryHead, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
12
- import { PackageContext__ModulePath_Z7E147617, PackageContext__NestedAmbientModuleSegments_32BC514A, PackageContext__IsEntryFile_Z721C83C5, ambientSpecifier, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
12
+ import { PackageContext__ModulePath_Z7E147617, PackageContext__NestedAmbientModuleSegments_32BC514A, PackageContext__IsExternalLibFile_Z721C83C5, PackageContext__IsEntryFile_Z721C83C5, ambientSpecifier, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
13
13
  import { tail, append, cons, tryHead as tryHead_1, exists as exists_1, tryFind, isEmpty, filter, head, tryItem, mapIndexed, choose, ofArray, contains, collect as collect_1, empty, map as map_1 } from "../../fable_modules/fable-library-js.5.17.2/List.js";
14
14
  import { item as item_1 } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
15
15
  import { contains as contains_1, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
@@ -699,6 +699,19 @@ export function resolveAlias(checker, symbol) {
699
699
  }
700
700
  }
701
701
 
702
+ /**
703
+ * `type X` beside `export { x as X }` is one symbol flagged both `TypeAlias` and `Alias`
704
+ */
705
+ export function resolveValueAlias(checker, symbol) {
706
+ const matchValue = symbol.flags;
707
+ if ($007CHasSymbolFlags$007C_$007C(788968, matchValue) != null) {
708
+ return symbol;
709
+ }
710
+ else {
711
+ return resolveAlias(checker, symbol);
712
+ }
713
+ }
714
+
702
715
  /**
703
716
  * `Omit<LabelOption, "rotate">` where `interface LabelOption<T = Params>`: `T` is `Params`
704
717
  */
@@ -772,40 +785,58 @@ export function declaredName(symbol) {
772
785
  */
773
786
  export function importedName(checker, symbol) {
774
787
  let target, target_1;
788
+ let isType;
775
789
  const matchValue = symbol.flags;
776
- if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue) != null) {
777
- const matchValue_1 = resolveAlias(checker, symbol);
778
- let matchResult, target_2, target_3;
779
- if (matchValue_1 != null) {
780
- if ((target = matchValue_1, target.name === "default")) {
781
- matchResult = 0;
782
- target_2 = matchValue_1;
783
- }
784
- else if ((target_1 = matchValue_1, (target_1.name !== symbol.name) && (target_1.name !== "export="))) {
785
- matchResult = 1;
786
- target_3 = matchValue_1;
787
- }
788
- else {
789
- matchResult = 2;
790
- }
790
+ isType = ($007CHasSymbolFlags$007C_$007C(788968, matchValue) != null);
791
+ const matchValue_1 = symbol.flags;
792
+ let matchResult;
793
+ if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue_1) != null) {
794
+ if (!isType) {
795
+ matchResult = 0;
791
796
  }
792
797
  else {
793
- matchResult = 2;
794
- }
795
- switch (matchResult) {
796
- case 0:
797
- return declaredName(target_2);
798
- case 1:
799
- return target_3.name;
800
- default:
801
- return undefined;
798
+ matchResult = 1;
802
799
  }
803
800
  }
804
- else if (symbol.name === "default") {
805
- return declaredName(symbol);
806
- }
807
801
  else {
808
- return undefined;
802
+ matchResult = 1;
803
+ }
804
+ switch (matchResult) {
805
+ case 0: {
806
+ const matchValue_2 = resolveAlias(checker, symbol);
807
+ let matchResult_1, target_2, target_3;
808
+ if (matchValue_2 != null) {
809
+ if ((target = matchValue_2, target.name === "default")) {
810
+ matchResult_1 = 0;
811
+ target_2 = matchValue_2;
812
+ }
813
+ else if ((target_1 = matchValue_2, (target_1.name !== symbol.name) && (target_1.name !== "export="))) {
814
+ matchResult_1 = 1;
815
+ target_3 = matchValue_2;
816
+ }
817
+ else {
818
+ matchResult_1 = 2;
819
+ }
820
+ }
821
+ else {
822
+ matchResult_1 = 2;
823
+ }
824
+ switch (matchResult_1) {
825
+ case 0:
826
+ return declaredName(target_2);
827
+ case 1:
828
+ return target_3.name;
829
+ default:
830
+ return undefined;
831
+ }
832
+ }
833
+ default:
834
+ if (symbol.name === "default") {
835
+ return declaredName(symbol);
836
+ }
837
+ else {
838
+ return undefined;
839
+ }
809
840
  }
810
841
  }
811
842
 
@@ -1342,8 +1373,8 @@ export function isGlobalScriptOfPackage(packageContext, sourceFile) {
1342
1373
  }
1343
1374
  else {
1344
1375
  const packageContext_1 = packageContext;
1345
- if (!(ts.isExternalModule(sourceFile)) && (promotedAmbientModule(sourceFile) == null)) {
1346
- return !PackageContext__IsEntryFile_Z721C83C5(packageContext_1, sourceFile.fileName);
1376
+ if ((!(ts.isExternalModule(sourceFile)) && (promotedAmbientModule(sourceFile) == null)) && !PackageContext__IsEntryFile_Z721C83C5(packageContext_1, sourceFile.fileName)) {
1377
+ return !PackageContext__IsExternalLibFile_Z721C83C5(packageContext_1, sourceFile.fileName);
1347
1378
  }
1348
1379
  else {
1349
1380
  return false;