@glutinum/cli 1.0.0-beta.14 → 1.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/Glutinum.Converter/GlueAST.js +19 -14
  2. package/dist/Glutinum.Converter/Merge.js +480 -205
  3. package/dist/Glutinum.Converter/Packages.js +2 -2
  4. package/dist/Glutinum.Converter/Printer.js +26 -21
  5. package/dist/Glutinum.Converter/Read.js +377 -169
  6. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
  7. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
  8. package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
  9. package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
  10. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
  11. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
  12. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
  13. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +4 -4
  14. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
  15. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
  16. package/dist/Glutinum.Converter/Reader/Node.js +1 -1
  17. package/dist/Glutinum.Converter/Reader/TypeNode.js +244 -29
  18. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
  19. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
  20. package/dist/Glutinum.Converter/Reader/UtilityType.js +114 -31
  21. package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
  22. package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
  23. package/dist/Glutinum.Converter/Transform.js +1062 -629
  24. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
  25. package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
  26. package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
  27. package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
  28. package/dist/Glutinum.Converter/Transformer/Heritage.js +275 -17
  29. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
  30. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
  31. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
  32. package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
  33. package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
  34. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
 
2
2
  import { Record } from "../fable_modules/fable-library-js.5.21.0/Types.js";
3
3
  import { int32_type, bool_type, array_type, list_type, record_type, class_type, string_type } from "../fable_modules/fable-library-js.5.21.0/Reflection.js";
4
- import { Reporter__get_HasIterable, Reporter__get_HasReadonlyArray, Reporter__get_HasRegEpx, Reporter__get_Errors, Reporter__get_Warnings, TransformState_Create_Z68CEF8E2, TypeLiteralsMemory_$ctor, Reporter_$ctor, TransformContext__ToList, importDefaultAttribute, TransformContext_$ctor_Z1635F75A, TypeLiteralsMemory__EnterFileModule_Z721C83C5, TransformContext__get__Reporter, TransformContext__set_SiblingTypeNames_2FCB1351, importAttribute, TypeLiteralsMemory__LeaveModule, TypeLiteralsMemory__EnterModule_Z721C83C5, TransformContext__ExposeTypeAlias_1CE4A880, TransformContext__AddWarning_Z721C83C5, sanitizeTypeNameAndPushScope, ImportSource, TransformContext__get_ImportSource, TransformContext__get_TypeMemory, sanitizeMemberNameAndPushScope, TransformContext__AddError_Z721C83C5, TypeLiteralsMemory__Remember_74C8CBB, TransformContext__get_TypeLiteralsMemory, TransformContext__get_Root, TypeLiteralsMemory__TryReference_433E080, TransformContext__get_State, TransformContext__get_FullName, TransformContext__ExposeType_Z1D58A540, TransformContext__PushScope_27AED5E3, sanitizeNameAndPushScope, TransformContext__NewTypeName, TransformContext__get_CurrentScopeName, TransformContext__ExposeIterable, TransformContext__ReferenceName_Z721C83C5, TransformContext__get_OriginalScopeName, TransformContext__ExposeTypeAlias_Z721C83C5, TransformContext__ExposeReadonlyArray, ImportSource_$reflection, TransformContext_$reflection } from "./Transformer/Context.js";
5
- import { GlueReExport, GlueVariable, GlueTypeReference, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueTypeUnion, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GluePrimitive, GlueProperty, GlueAccessor, GlueFunctionDeclaration, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, GlueType, GlueTypeLiteral, GlueMember, GlueTypeParameter, GlueSubstitution_substitute, GlueSubstitution_substituteParameter, GlueInterface, GlueTypeAliasDeclaration_$reflection } from "./GlueAST.js";
4
+ import { Reporter__get_HasIterable, Reporter__get_HasReadonlyArray, Reporter__get_HasRegEpx, Reporter__get_Errors, Reporter__get_Warnings, TransformState_Create_Z68CEF8E2, TypeLiteralsMemory_$ctor, Reporter_$ctor, TransformContext__ToList, importDefaultAttribute, TransformContext_$ctor_Z1635F75A, TypeLiteralsMemory__EnterFileModule_Z721C83C5, TransformContext__get__Reporter, TransformContext__set_SiblingTypeNames_2FCB1351, importAttribute, TypeLiteralsMemory__LeaveModule, TypeLiteralsMemory__EnterModule_Z721C83C5, TransformContext__ExposeTypeAlias_1CE4A880, TransformContext__AddWarning_Z721C83C5, sanitizeTypeNameAndPushScope, ImportSource, TransformContext__get_ImportSource, sanitizeMemberNameAndPushScope, TransformContext__AddError_Z721C83C5, TypeLiteralsMemory__get_RootModuleName, TypeLiteralsMemory__Remember_74C8CBB, TransformContext__get_TypeMemory, TransformContext__get_TypeLiteralsMemory, TransformContext__get_Root, TypeLiteralsMemory__TryReference_433E080, TransformContext__get_State, TransformContext__get_FullName, TransformContext__ExposeType_Z1D58A540, TransformContext__PushScope_27AED5E3, sanitizeNameAndPushScope, TransformContext__NewTypeName, TransformContext__get_CurrentScopeName, TransformContext__ExposeIterable, TransformContext__ReferenceName_Z721C83C5, TransformContext__get_OriginalScopeName, TransformContext__ExposeTypeAlias_Z721C83C5, TransformContext__ExposeReadonlyArray, ImportSource_$reflection, TransformContext_$reflection } from "./Transformer/Context.js";
5
+ import { GlueReExport, GlueVariable, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueThisType, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GlueTypeUnion, GluePrimitive, GlueAccessor, GlueFunctionDeclaration, GlueSubstitution_mentionedTypeParameters, GlueSubstitution_substitute, GlueFunctionType, GlueParameter, GlueTypeLiteral, GlueGetAccessor, GlueProperty, GlueMethod, GlueConstructor, GlueMember, GlueMethodSignature, GlueTypeReference, GlueType, GlueTypeParameter, GlueSubstitution_substituteParameter, GlueInterface, GlueTypeAliasDeclaration_$reflection } from "./GlueAST.js";
6
6
  import { transformComment, TransformCommentResult_$reflection } from "./Transformer/Comment.js";
7
7
  import { SealedTypeInfo, TransformDeclarationTypeParametersResult, TransformTypeParametersResult, TransformResult_Create_403667D8, mapFSharpType, mapFsharpParameter, TransformDeclarationTypeParametersResult_$reflection } from "./Transformer/TypeParameter.js";
8
- import { FSharpModule, FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpEnum, FSharpEnumCase, FSharpLiteral, FSharpUnionCaseNamed, FSharpClass, FSharpConstructor, FSharpExplicitField, FSharpMemberInfoBody, FSharpAccessibility, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpAccessor, FSharpParameter, FSharpThisType, FSharpPrimitive, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpTypeParameter, FSharpMapped, FSharpInterface, FSharpAttribute, FSharpType, FSharpType_$reflection } from "./FsharpAST.js";
8
+ import { FSharpModule, FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpEnum, FSharpEnumCase, FSharpLiteral, FSharpUnionCaseNamed, FSharpClass, FSharpConstructor, FSharpExplicitField, FSharpMemberInfoBody, FSharpAccessibility, FSharpStaticMemberInfo, FSharpAccessor, FSharpParameter, FSharpThisType, FSharpPrimitive, FSharpMember, FSharpMemberInfo, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpTypeParameter, FSharpMapped, FSharpInterface, FSharpAttribute, FSharpType, FSharpType_$reflection } from "./FsharpAST.js";
9
9
  import { ofSeq as ofSeq_1, empty as empty_3, add, contains as contains_2, ofList, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.21.0/Set.js";
10
10
  import { aggregatedExports, replaceSelfReference, isUnitAlias, typedArrayNames, transformPrimitive, requiredBeforeParamArray, isDataObject, Interface_makePartial, tryUnwrapOption, iteratorNames } from "./Transformer/Utils.js";
11
- import { toArray, value as value_7, defaultArg } from "../fable_modules/fable-library-js.5.21.0/Option.js";
12
- import { zip, mapFold, tryPick, item, concat as concat_1, reverse, iterate, cons, foldBack, fold, sortBy, tryFind, ofSeq, truncate, contains, exists, partition, mapIndexed, forAll, map2, filter, append, length, collect, tryLast, choose, tryHead, singleton, empty, ofArray, map, head as head_1, tail as tail_1, isEmpty } from "../fable_modules/fable-library-js.5.21.0/List.js";
11
+ import { toArray, value as value_8, defaultArg } from "../fable_modules/fable-library-js.5.21.0/Option.js";
12
+ import { zip, mapFold, item as item_1, concat as concat_1, reverse, iterate, foldBack, fold, sortBy, tryFind, ofSeq, truncate, cons, contains, exists, partition, tryPick, mapIndexed, forAll, map2, filter, append, length, collect, tryLast, choose, tryHead, singleton, empty, ofArray, map, head as head_1, tail as tail_1, isEmpty } from "../fable_modules/fable-library-js.5.21.0/List.js";
13
13
  import { aliasArities, membersNameUndeclaredTypeParameters, mentionsTypeParameter, ownTypeParameterDefaults, typeParameterNames as typeParameterNames_2, unconstrained, memberTypeParameterNames, typeArguments, declaredTypeParameters as declaredTypeParameters_1 } from "./Transformer/TypeParameters.js";
14
- import { List_groupBy, List_distinct } from "../fable_modules/fable-library-js.5.21.0/Seq2.js";
14
+ import { List_groupBy, List_distinctBy, List_distinct } from "../fable_modules/fable-library-js.5.21.0/Seq2.js";
15
15
  import { uncurry2, curry2, Lazy, Exception, numberHash, int32ToString, comparePrimitives, safeHash, structuralHash, equals, stringHash } from "../fable_modules/fable-library-js.5.21.0/Util.js";
16
16
  import { replace, interpolate, substring, trimStart, split, trim, concat } from "../fable_modules/fable-library-js.5.21.0/String.js";
17
17
  import { resolveMembers, isConditionalAlias, isInterfaceDeclaration } from "./Transformer/Conditionals.js";
@@ -25,10 +25,10 @@ import { expandMembers } from "./Transformer/AnyFunctionOverloads.js";
25
25
  import { isMap, keysModule, isMapNamed, expandMembers as expandMembers_1 } from "./Transformer/KeyOfMaps.js";
26
26
  import { defaultMaxOverloads, isNullish, tryCases, expandMembers as expandMembers_2 } from "./Transformer/UnionOverloads.js";
27
27
  import { applyWith as applyWith_1, disambiguateOverloads, aliasesOf, parametersSignature, Aliases_get_Empty, distinctBySignature } from "./Merge.js";
28
- import { min } from "../fable_modules/fable-library-js.5.21.0/Double.js";
28
+ import { isCandidate, tryResolveMembers, methodAsProperty } from "./Transformer/ParamObjectCandidate.js";
29
+ import { max, min } from "../fable_modules/fable-library-js.5.21.0/Double.js";
29
30
  import { inheritsIterable, asMethods, tryCallableHeritage } from "./Transformer/CallableProperties.js";
30
- import { withoutBaseClassProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, withoutRedeclaredBases } from "./Transformer/Heritage.js";
31
- import { isCandidate, tryResolveMembers } from "./Transformer/ParamObjectCandidate.js";
31
+ import { withoutBaseClassProperties, tryAllProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, thisMembersOfBases, withoutRedeclaredBases } from "./Transformer/Heritage.js";
32
32
  import { op_UnaryNegation_Int32 } from "../fable_modules/fable-library-js.5.21.0/Int32.js";
33
33
  import { transformEnum } from "./Transformer/Enum.js";
34
34
  import { Transforms, transformExports } from "./Transformer/Exports.js";
@@ -933,7 +933,7 @@ function erasedUnion(name, typeParameters, caseTypes) {
933
933
  else {
934
934
  return false;
935
935
  }
936
- }, names)) ? map(value_7, names) : mapIndexed((index, _arg) => (`Case${index + 1}`), caseTypes), caseTypes), false, typeParameters, empty(), empty());
936
+ }, names)) ? map(value_8, names) : mapIndexed((index, _arg) => (`Case${index + 1}`), caseTypes), caseTypes), false, typeParameters, empty(), empty());
937
937
  }
938
938
 
939
939
  function referenceToExposed(context, name, typeParameterNames) {
@@ -941,6 +941,74 @@ function referenceToExposed(context, name, typeParameterNames) {
941
941
  return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(fullName, fullName, empty(), map((Item) => (new FSharpType(/* TypeParameter */ 13, [Item])), typeParameterNames), FSharpType.Discard)]);
942
942
  }
943
943
 
944
+ function withoutAliasesOfSamePrimitive(context, cases) {
945
+ const primitiveOfAlias = (depth, glueType) => {
946
+ let reference;
947
+ let matchResult, reference_1;
948
+ switch (glueType.tag) {
949
+ case 3: {
950
+ matchResult = 0;
951
+ break;
952
+ }
953
+ case 13: {
954
+ if ((reference = glueType.fields[0], ((depth < 5) && isEmpty(reference.TypeArguments)) && (reference.FullName !== ""))) {
955
+ matchResult = 1;
956
+ reference_1 = glueType.fields[0];
957
+ }
958
+ else {
959
+ matchResult = 2;
960
+ }
961
+ break;
962
+ }
963
+ default:
964
+ matchResult = 2;
965
+ }
966
+ switch (matchResult) {
967
+ case 0:
968
+ return glueType;
969
+ case 1:
970
+ return tryPick((_arg) => {
971
+ let matchResult_1, aliased_1, fullName_1;
972
+ if (_arg.tag === 5) {
973
+ if (isEmpty(_arg.fields[0].TypeParameters)) {
974
+ if (_arg.fields[0].FullName === reference_1.FullName) {
975
+ matchResult_1 = 0;
976
+ aliased_1 = _arg.fields[0].Type;
977
+ fullName_1 = _arg.fields[0].FullName;
978
+ }
979
+ else {
980
+ matchResult_1 = 1;
981
+ }
982
+ }
983
+ else {
984
+ matchResult_1 = 1;
985
+ }
986
+ }
987
+ else {
988
+ matchResult_1 = 1;
989
+ }
990
+ switch (matchResult_1) {
991
+ case 0:
992
+ return primitiveOfAlias(depth + 1, aliased_1);
993
+ default:
994
+ return undefined;
995
+ }
996
+ }, TransformContext__get_TypeMemory(context));
997
+ default:
998
+ return undefined;
999
+ }
1000
+ };
1001
+ if (length(cases) > 1) {
1002
+ return List_distinctBy((case$) => defaultArg(primitiveOfAlias(0, case$), case$), cases, {
1003
+ Equals: equals,
1004
+ GetHashCode: (x) => (safeHash(x) | 0),
1005
+ });
1006
+ }
1007
+ else {
1008
+ return cases;
1009
+ }
1010
+ }
1011
+
944
1012
  function transformUnionType(context, cases) {
945
1013
  let typ, unionInfo;
946
1014
  const patternInput = partition((glueType) => {
@@ -961,11 +1029,11 @@ function transformUnionType(context, cases) {
961
1029
  const others = patternInput[1];
962
1030
  const optionalTypes = patternInput[0];
963
1031
  const isOptional = !isEmpty(optionalTypes);
964
- const others_1 = (length(others) > 1) ? map(arrayAsInput, others) : others;
965
- if (isOptional && (length(others_1) === 1)) {
966
- return new FSharpType(/* Option */ 3, [transformType(context, head_1(others_1))]);
1032
+ const others_2 = withoutAliasesOfSamePrimitive(context, (length(others) > 1) ? map(arrayAsInput, others) : others);
1033
+ if (isOptional && (length(others_2) === 1)) {
1034
+ return new FSharpType(/* Option */ 3, [transformType(context, head_1(others_2))]);
967
1035
  }
968
- else if (isEmpty(others_1)) {
1036
+ else if (isEmpty(others_2)) {
969
1037
  if (!isEmpty(optionalTypes)) {
970
1038
  return transformType(context, head_1(optionalTypes));
971
1039
  }
@@ -973,16 +1041,16 @@ function transformUnionType(context, cases) {
973
1041
  return FSharpType.Object$;
974
1042
  }
975
1043
  }
976
- else if (length(others_1) === 1) {
977
- return transformType(context, head_1(others_1));
1044
+ else if (length(others_2) === 1) {
1045
+ return transformType(context, head_1(others_2));
978
1046
  }
979
1047
  else {
980
- const matchValue = tryOptimizeUnionType(context, TransformContext__get_CurrentScopeName(context), others_1);
1048
+ const matchValue = tryOptimizeUnionType(context, TransformContext__get_CurrentScopeName(context), others_2);
981
1049
  if (matchValue == null) {
982
- const isLarge = length(others_1) > 9;
983
- const name_1 = isLarge ? TransformContext__NewTypeName(context) : (`U${length(others_1)}`);
1050
+ const isLarge = length(others_2) > 9;
1051
+ const name_1 = isLarge ? TransformContext__NewTypeName(context) : (`U${length(others_2)}`);
984
1052
  const caseContext = isLarge ? context : sanitizeNameAndPushScope(name_1, context)[1];
985
- const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(caseContext, `Case${index + 1}`), caseType), others_1), {
1053
+ const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(caseContext, `Case${index + 1}`), caseType), others_2), {
986
1054
  Equals: equals,
987
1055
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
988
1056
  });
@@ -1009,7 +1077,7 @@ function transformUnionType(context, cases) {
1009
1077
  case 0:
1010
1078
  return single;
1011
1079
  case 1: {
1012
- const typeParameterNames_1 = List_distinct(collect(typeParameterNames_2, others_1), {
1080
+ const typeParameterNames_1 = List_distinct(collect(typeParameterNames_2, others_2), {
1013
1081
  Equals: (x_2, y_2) => (x_2 === y_2),
1014
1082
  GetHashCode: (x_2) => (stringHash(x_2) | 0),
1015
1083
  });
@@ -1030,12 +1098,12 @@ function transformUnionType(context, cases) {
1030
1098
  }
1031
1099
  else {
1032
1100
  const name = TransformContext__NewTypeName(context);
1033
- const typeParameterNames = List_distinct(collect(typeParameterNames_2, others_1), {
1101
+ const typeParameterNames = List_distinct(collect(typeParameterNames_2, others_2), {
1034
1102
  Equals: (x, y) => (x === y),
1035
1103
  GetHashCode: (x) => (stringHash(x) | 0),
1036
1104
  });
1037
1105
  let option_3;
1038
- const option_1 = tryOptimizeUnionType(context, name, others_1);
1106
+ const option_1 = tryOptimizeUnionType(context, name, others_2);
1039
1107
  option_3 = ((option_1 != null) ? ((typ = option_1, (typ.tag === 1) ? ((unionInfo = typ.fields[0], new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, declaredTypeParameters_1(typeParameterNames), unionInfo.Constants, unionInfo.Conversions)]))) : typ)) : undefined);
1040
1108
  if (option_3 != null) {
1041
1109
  TransformContext__ExposeType_Z1D58A540(context, option_3);
@@ -1091,7 +1159,7 @@ function transformFunctionType(context, functionTypeInfo) {
1091
1159
  switch (matchResult) {
1092
1160
  case 0: {
1093
1161
  const ownDefaults = ownTypeParameterDefaults(functionTypeInfo);
1094
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter_2) => transformParameter(context, parameter_2), map((parameter_1) => GlueSubstitution_substituteParameter(ownDefaults, parameter_1), paremeters))), transformCallbackReturnType(context, GlueSubstitution_substitute(ownDefaults, functionTypeInfo.Type)))]);
1162
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter_2) => transformParameter(context, parameter_2), map((parameter_1) => GlueSubstitution_substituteParameter(ownDefaults, parameter_1), paremeters))), transformOwnCallbackReturnType(context, ownDefaults, functionTypeInfo.Type))]);
1095
1163
  }
1096
1164
  default: {
1097
1165
  let typParameters;
@@ -1159,7 +1227,7 @@ function transformTypeLiteral(context, typeLiteralInfo) {
1159
1227
  TransformContext__ExposeType_Z1D58A540(context, new FSharpType(/* Class */ 17, [transformParamObjectClass(context, name, empty(), typeLiteralInfo.Members)]));
1160
1228
  }
1161
1229
  else {
1162
- const creates = isParamObjectCandidate ? paramObjectCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(name, typeArguments(typeParameterNames))]), typeLiteralInfo.Members) : empty();
1230
+ const creates = isParamObjectCandidate ? paramObjectCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(name, typeArguments(typeParameterNames))]), typeLiteralInfo.Members) : dictionaryCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(name, typeArguments(typeParameterNames))]), typeLiteralInfo.Members);
1163
1231
  const inheritance = ofArray(toArray(TypeLiteral_tryFindIterableType(context, typeLiteralInfo.Members)));
1164
1232
  TransformContext__ExposeType_Z1D58A540(context, new FSharpType(/* Interface */ 5, [(bind$0040 = anonymousInterface(context, name, typeParameterNames, append(transformedMembers, creates), inheritance), new FSharpInterface(bind$0040.Attributes, bind$0040.Name, bind$0040.XmlDoc, "", bind$0040.TypeParameters, bind$0040.Members, bind$0040.Inheritance))]));
1165
1233
  }
@@ -1177,7 +1245,12 @@ function transformTypeLiteral(context, typeLiteralInfo) {
1177
1245
  function transformIntersectionOfReferences(context, references, members) {
1178
1246
  const bases = inheritableBases(context, references);
1179
1247
  if (isEmpty(bases)) {
1180
- return FSharpType.Object$;
1248
+ if (isEmpty(references)) {
1249
+ return FSharpType.Object$;
1250
+ }
1251
+ else {
1252
+ return transformType(context, head_1(references));
1253
+ }
1181
1254
  }
1182
1255
  else {
1183
1256
  const typeParameterNames = List_distinct(collect(typeParameterNames_2, references), {
@@ -1223,125 +1296,209 @@ function transformMappedType(context, mappedType) {
1223
1296
  }
1224
1297
  }
1225
1298
 
1299
+ function transformClassConstructor(context, reference) {
1300
+ if (exists((_arg) => {
1301
+ if (_arg.tag === 12) {
1302
+ return _arg.fields[0].FullName === reference.FullName;
1303
+ }
1304
+ else {
1305
+ return false;
1306
+ }
1307
+ }, TransformContext__get_TypeMemory(context))) {
1308
+ const className = mapTypeNameToFableCoreAwareName(context, reference);
1309
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference((equals(TypeLiteralsMemory__get_RootModuleName(TransformContext__get_TypeLiteralsMemory(context)), sanitizeTypeName(className)) ? (className + "_") : className) + ".Constructor", reference.FullName + ".Constructor", reference.ModulePath, empty(), FSharpType.Discard)]);
1310
+ }
1311
+ else {
1312
+ return FSharpType.Object$;
1313
+ }
1314
+ }
1315
+
1316
+ function exposeClassConstructor(classContext, info) {
1317
+ let bind$0040;
1318
+ const context = TransformContext__PushScope_27AED5E3(classContext, "Constructor");
1319
+ const instanceType = new GlueType(/* TypeReference */ 13, [new GlueTypeReference(info.Name, info.FullName, empty(), map((typeParameter) => (new GlueType(/* TypeParameter */ 16, [typeParameter.Name])), info.TypeParameters), false)]);
1320
+ TransformContext__ExposeType_Z1D58A540(context, new FSharpType(/* Interface */ 5, [(bind$0040 = anonymousInterface(context, "Constructor", empty(), append(map((_arg) => {
1321
+ if (_arg.tag === 0) {
1322
+ const method = _arg.fields[0];
1323
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(cons(FSharpAttribute.EmitConstructor, method.Attributes), method.Name, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, method.IsOptional, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc, method.Body)]);
1324
+ }
1325
+ else {
1326
+ return _arg;
1327
+ }
1328
+ }, TransformMembers_toFSharpMember(context, map((constructor) => (new GlueMember(/* MethodSignature */ 6, [new GlueMethodSignature("Create", constructor.Documentation, info.TypeParameters, constructor.Parameters, instanceType, false)])), isEmpty(info.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : info.Constructors))), TransformMembers_toFSharpMember(context, choose((_arg_1) => {
1329
+ let property, accessor;
1330
+ let matchResult, method_2, property_1, accessor_1;
1331
+ switch (_arg_1.tag) {
1332
+ case 0: {
1333
+ if (_arg_1.fields[0].IsStatic) {
1334
+ matchResult = 0;
1335
+ method_2 = _arg_1.fields[0];
1336
+ }
1337
+ else {
1338
+ matchResult = 3;
1339
+ }
1340
+ break;
1341
+ }
1342
+ case 1: {
1343
+ if ((property = _arg_1.fields[0], property.IsStatic && !property.IsPrivate)) {
1344
+ matchResult = 1;
1345
+ property_1 = _arg_1.fields[0];
1346
+ }
1347
+ else {
1348
+ matchResult = 3;
1349
+ }
1350
+ break;
1351
+ }
1352
+ case 2: {
1353
+ if ((accessor = _arg_1.fields[0], accessor.IsStatic && !accessor.IsPrivate)) {
1354
+ matchResult = 2;
1355
+ accessor_1 = _arg_1.fields[0];
1356
+ }
1357
+ else {
1358
+ matchResult = 3;
1359
+ }
1360
+ break;
1361
+ }
1362
+ default:
1363
+ matchResult = 3;
1364
+ }
1365
+ switch (matchResult) {
1366
+ case 0:
1367
+ return new GlueMember(/* Method */ 0, [new GlueMethod(method_2.Name, method_2.Documentation, method_2.TypeParameters, method_2.Parameters, method_2.Type, method_2.IsOptional, false)]);
1368
+ case 1:
1369
+ return new GlueMember(/* Property */ 1, [new GlueProperty(property_1.Name, property_1.Documentation, property_1.Type, false, property_1.IsOptional, property_1.Accessor, property_1.IsPrivate)]);
1370
+ case 2:
1371
+ return new GlueMember(/* GetAccessor */ 2, [new GlueGetAccessor(accessor_1.Name, accessor_1.Documentation, accessor_1.Type, false, accessor_1.IsPrivate)]);
1372
+ default:
1373
+ return undefined;
1374
+ }
1375
+ }, info.Members))), empty()), new FSharpInterface(bind$0040.Attributes, bind$0040.Name, bind$0040.XmlDoc, "", bind$0040.TypeParameters, bind$0040.Members, bind$0040.Inheritance))]));
1376
+ }
1377
+
1226
1378
  function transformType(context_mut, glueType_mut) {
1227
1379
  transformType:
1228
1380
  while (true) {
1229
1381
  const context = context_mut, glueType = glueType_mut;
1230
- let matchResult, constructSignature, primitiveInfo, glueType_21, thisTypeInfo, glueTypes, glueType_22, cases, typeReference_2, typeReference_3, argument, typeReference_4, glueType_25, classDeclaration, name, functionTypeInfo, interfaceInfo, name_1, typeLiteralInfo, glueType_26, info, innerGlueType, namedTupleType, glueLiteral, functionDeclaration_1, functionDeclaration_2, members, references, members_1, utilityType, typeAliasDeclaration, mappedType;
1382
+ let matchResult, reference, constructSignature, primitiveInfo, glueType_21, thisTypeInfo, glueTypes, glueType_22, cases, typeReference_2, typeReference_3, argument, typeReference_4, glueType_25, classDeclaration, name, functionTypeInfo, interfaceInfo, name_1, typeLiteralInfo, glueType_26, info, innerGlueType, namedTupleType, glueLiteral, functionDeclaration_1, functionDeclaration_2, members, references, members_1, utilityType, typeAliasDeclaration, mappedType;
1231
1383
  switch (glueType.tag) {
1232
- case 29: {
1384
+ case 30: {
1233
1385
  matchResult = 1;
1386
+ reference = glueType.fields[0];
1387
+ break;
1388
+ }
1389
+ case 29: {
1390
+ matchResult = 2;
1234
1391
  constructSignature = glueType.fields[0];
1235
1392
  break;
1236
1393
  }
1237
1394
  case 3: {
1238
- matchResult = 2;
1395
+ matchResult = 3;
1239
1396
  primitiveInfo = glueType.fields[0];
1240
1397
  break;
1241
1398
  }
1242
1399
  case 26: {
1243
- matchResult = 3;
1400
+ matchResult = 4;
1244
1401
  break;
1245
1402
  }
1246
1403
  case 23: {
1247
- matchResult = 4;
1404
+ matchResult = 5;
1248
1405
  glueType_21 = glueType.fields[0];
1249
1406
  break;
1250
1407
  }
1251
1408
  case 17: {
1252
- matchResult = 5;
1409
+ matchResult = 6;
1253
1410
  thisTypeInfo = glueType.fields[0];
1254
1411
  break;
1255
1412
  }
1256
1413
  case 18: {
1257
- matchResult = 6;
1414
+ matchResult = 7;
1258
1415
  glueTypes = glueType.fields[0];
1259
1416
  break;
1260
1417
  }
1261
- case 30: {
1262
- matchResult = 7;
1418
+ case 31: {
1419
+ matchResult = 8;
1263
1420
  glueType_22 = glueType.fields[0];
1264
1421
  break;
1265
1422
  }
1266
1423
  case 7: {
1267
- matchResult = 8;
1424
+ matchResult = 9;
1268
1425
  cases = glueType.fields[0].fields[0];
1269
1426
  break;
1270
1427
  }
1271
1428
  case 13: {
1272
1429
  if (isConditionalAlias(TransformContext__get_State(context).Conditionals, glueType.fields[0].FullName)) {
1273
- matchResult = 9;
1430
+ matchResult = 10;
1274
1431
  typeReference_2 = glueType.fields[0];
1275
1432
  }
1276
1433
  else if (mapTypeNameToFableCoreAwareName(context, glueType.fields[0]) === "obj") {
1277
- matchResult = 10;
1434
+ matchResult = 11;
1278
1435
  typeReference_3 = glueType.fields[0];
1279
1436
  }
1280
1437
  else if (glueType.fields[0].Name === "Readonly") {
1281
1438
  if (!isEmpty(glueType.fields[0].TypeArguments)) {
1282
1439
  if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
1283
1440
  if (glueType.fields[0].IsStandardLibrary) {
1284
- matchResult = 11;
1441
+ matchResult = 12;
1285
1442
  argument = head_1(glueType.fields[0].TypeArguments);
1286
1443
  }
1287
1444
  else {
1288
- matchResult = 12;
1445
+ matchResult = 13;
1289
1446
  typeReference_4 = glueType.fields[0];
1290
1447
  }
1291
1448
  }
1292
1449
  else {
1293
- matchResult = 12;
1450
+ matchResult = 13;
1294
1451
  typeReference_4 = glueType.fields[0];
1295
1452
  }
1296
1453
  }
1297
1454
  else {
1298
- matchResult = 12;
1455
+ matchResult = 13;
1299
1456
  typeReference_4 = glueType.fields[0];
1300
1457
  }
1301
1458
  }
1302
1459
  else {
1303
- matchResult = 12;
1460
+ matchResult = 13;
1304
1461
  typeReference_4 = glueType.fields[0];
1305
1462
  }
1306
1463
  break;
1307
1464
  }
1308
1465
  case 14: {
1309
- matchResult = 13;
1466
+ matchResult = 14;
1310
1467
  glueType_25 = glueType.fields[0];
1311
1468
  break;
1312
1469
  }
1313
1470
  case 12: {
1314
- matchResult = 14;
1471
+ matchResult = 15;
1315
1472
  classDeclaration = glueType.fields[0];
1316
1473
  break;
1317
1474
  }
1318
1475
  case 16: {
1319
- matchResult = 15;
1476
+ matchResult = 16;
1320
1477
  name = glueType.fields[0];
1321
1478
  break;
1322
1479
  }
1323
1480
  case 15: {
1324
- matchResult = 16;
1481
+ matchResult = 17;
1325
1482
  functionTypeInfo = glueType.fields[0];
1326
1483
  break;
1327
1484
  }
1328
1485
  case 1: {
1329
- matchResult = 17;
1486
+ matchResult = 18;
1330
1487
  interfaceInfo = glueType.fields[0];
1331
1488
  break;
1332
1489
  }
1333
1490
  case 22: {
1334
1491
  if (isEmpty(glueType.fields[0].Members)) {
1335
- matchResult = 18;
1492
+ matchResult = 19;
1336
1493
  }
1337
1494
  else {
1338
1495
  const activePatternResult = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1339
1496
  if (activePatternResult != null) {
1340
- matchResult = 19;
1497
+ matchResult = 20;
1341
1498
  name_1 = activePatternResult;
1342
1499
  }
1343
1500
  else {
1344
- matchResult = 20;
1501
+ matchResult = 21;
1345
1502
  typeLiteralInfo = glueType.fields[0];
1346
1503
  }
1347
1504
  }
@@ -1350,11 +1507,11 @@ function transformType(context_mut, glueType_mut) {
1350
1507
  case 25: {
1351
1508
  const activePatternResult_1 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1352
1509
  if (activePatternResult_1 != null) {
1353
- matchResult = 19;
1510
+ matchResult = 20;
1354
1511
  name_1 = activePatternResult_1;
1355
1512
  }
1356
1513
  else {
1357
- matchResult = 21;
1514
+ matchResult = 22;
1358
1515
  glueType_26 = glueType.fields[0];
1359
1516
  }
1360
1517
  break;
@@ -1362,11 +1519,11 @@ function transformType(context_mut, glueType_mut) {
1362
1519
  case 2: {
1363
1520
  const activePatternResult_2 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1364
1521
  if (activePatternResult_2 != null) {
1365
- matchResult = 19;
1522
+ matchResult = 20;
1366
1523
  name_1 = activePatternResult_2;
1367
1524
  }
1368
1525
  else {
1369
- matchResult = 22;
1526
+ matchResult = 23;
1370
1527
  info = glueType.fields[0];
1371
1528
  }
1372
1529
  break;
@@ -1374,11 +1531,11 @@ function transformType(context_mut, glueType_mut) {
1374
1531
  case 9: {
1375
1532
  const activePatternResult_3 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1376
1533
  if (activePatternResult_3 != null) {
1377
- matchResult = 19;
1534
+ matchResult = 20;
1378
1535
  name_1 = activePatternResult_3;
1379
1536
  }
1380
1537
  else {
1381
- matchResult = 23;
1538
+ matchResult = 24;
1382
1539
  innerGlueType = glueType.fields[0];
1383
1540
  }
1384
1541
  break;
@@ -1386,11 +1543,11 @@ function transformType(context_mut, glueType_mut) {
1386
1543
  case 19: {
1387
1544
  const activePatternResult_4 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1388
1545
  if (activePatternResult_4 != null) {
1389
- matchResult = 19;
1546
+ matchResult = 20;
1390
1547
  name_1 = activePatternResult_4;
1391
1548
  }
1392
1549
  else {
1393
- matchResult = 24;
1550
+ matchResult = 25;
1394
1551
  namedTupleType = glueType.fields[0];
1395
1552
  }
1396
1553
  break;
@@ -1398,22 +1555,22 @@ function transformType(context_mut, glueType_mut) {
1398
1555
  case 0: {
1399
1556
  const activePatternResult_5 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1400
1557
  if (activePatternResult_5 != null) {
1401
- matchResult = 19;
1558
+ matchResult = 20;
1402
1559
  name_1 = activePatternResult_5;
1403
1560
  }
1404
1561
  else {
1405
- matchResult = 25;
1562
+ matchResult = 26;
1406
1563
  }
1407
1564
  break;
1408
1565
  }
1409
1566
  case 8: {
1410
1567
  const activePatternResult_6 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1411
1568
  if (activePatternResult_6 != null) {
1412
- matchResult = 19;
1569
+ matchResult = 20;
1413
1570
  name_1 = activePatternResult_6;
1414
1571
  }
1415
1572
  else {
1416
- matchResult = 26;
1573
+ matchResult = 27;
1417
1574
  glueLiteral = glueType.fields[0];
1418
1575
  }
1419
1576
  break;
@@ -1421,15 +1578,15 @@ function transformType(context_mut, glueType_mut) {
1421
1578
  case 6: {
1422
1579
  const activePatternResult_7 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1423
1580
  if (activePatternResult_7 != null) {
1424
- matchResult = 19;
1581
+ matchResult = 20;
1425
1582
  name_1 = activePatternResult_7;
1426
1583
  }
1427
1584
  else if (!isEmpty(glueType.fields[0].TypeParameters)) {
1428
- matchResult = 27;
1585
+ matchResult = 28;
1429
1586
  functionDeclaration_1 = glueType.fields[0];
1430
1587
  }
1431
1588
  else {
1432
- matchResult = 28;
1589
+ matchResult = 29;
1433
1590
  functionDeclaration_2 = glueType.fields[0];
1434
1591
  }
1435
1592
  break;
@@ -1437,11 +1594,11 @@ function transformType(context_mut, glueType_mut) {
1437
1594
  case 21: {
1438
1595
  const activePatternResult_8 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1439
1596
  if (activePatternResult_8 != null) {
1440
- matchResult = 19;
1597
+ matchResult = 20;
1441
1598
  name_1 = activePatternResult_8;
1442
1599
  }
1443
1600
  else {
1444
- matchResult = 29;
1601
+ matchResult = 30;
1445
1602
  members = glueType.fields[1];
1446
1603
  references = glueType.fields[0];
1447
1604
  }
@@ -1450,11 +1607,11 @@ function transformType(context_mut, glueType_mut) {
1450
1607
  case 20: {
1451
1608
  const activePatternResult_9 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1452
1609
  if (activePatternResult_9 != null) {
1453
- matchResult = 19;
1610
+ matchResult = 20;
1454
1611
  name_1 = activePatternResult_9;
1455
1612
  }
1456
1613
  else {
1457
- matchResult = 30;
1614
+ matchResult = 31;
1458
1615
  members_1 = glueType.fields[0];
1459
1616
  }
1460
1617
  break;
@@ -1462,11 +1619,11 @@ function transformType(context_mut, glueType_mut) {
1462
1619
  case 27: {
1463
1620
  const activePatternResult_10 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1464
1621
  if (activePatternResult_10 != null) {
1465
- matchResult = 19;
1622
+ matchResult = 20;
1466
1623
  name_1 = activePatternResult_10;
1467
1624
  }
1468
1625
  else {
1469
- matchResult = 31;
1626
+ matchResult = 32;
1470
1627
  utilityType = glueType.fields[0];
1471
1628
  }
1472
1629
  break;
@@ -1474,11 +1631,11 @@ function transformType(context_mut, glueType_mut) {
1474
1631
  case 5: {
1475
1632
  const activePatternResult_11 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1476
1633
  if (activePatternResult_11 != null) {
1477
- matchResult = 19;
1634
+ matchResult = 20;
1478
1635
  name_1 = activePatternResult_11;
1479
1636
  }
1480
1637
  else {
1481
- matchResult = 32;
1638
+ matchResult = 33;
1482
1639
  typeAliasDeclaration = glueType.fields[0];
1483
1640
  }
1484
1641
  break;
@@ -1486,11 +1643,11 @@ function transformType(context_mut, glueType_mut) {
1486
1643
  case 28: {
1487
1644
  const activePatternResult_12 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1488
1645
  if (activePatternResult_12 != null) {
1489
- matchResult = 19;
1646
+ matchResult = 20;
1490
1647
  name_1 = activePatternResult_12;
1491
1648
  }
1492
1649
  else {
1493
- matchResult = 33;
1650
+ matchResult = 34;
1494
1651
  mappedType = glueType.fields[0];
1495
1652
  }
1496
1653
  break;
@@ -1498,66 +1655,66 @@ function transformType(context_mut, glueType_mut) {
1498
1655
  case 10: {
1499
1656
  const activePatternResult_13 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1500
1657
  if (activePatternResult_13 != null) {
1501
- matchResult = 19;
1658
+ matchResult = 20;
1502
1659
  name_1 = activePatternResult_13;
1503
1660
  }
1504
1661
  else {
1505
- matchResult = 34;
1662
+ matchResult = 35;
1506
1663
  }
1507
1664
  break;
1508
1665
  }
1509
1666
  case 11: {
1510
1667
  const activePatternResult_14 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1511
1668
  if (activePatternResult_14 != null) {
1512
- matchResult = 19;
1669
+ matchResult = 20;
1513
1670
  name_1 = activePatternResult_14;
1514
1671
  }
1515
1672
  else {
1516
- matchResult = 35;
1673
+ matchResult = 36;
1517
1674
  }
1518
1675
  break;
1519
1676
  }
1520
- case 33: {
1677
+ case 34: {
1521
1678
  const activePatternResult_15 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1522
1679
  if (activePatternResult_15 != null) {
1523
- matchResult = 19;
1680
+ matchResult = 20;
1524
1681
  name_1 = activePatternResult_15;
1525
1682
  }
1526
1683
  else {
1527
- matchResult = 36;
1684
+ matchResult = 37;
1528
1685
  }
1529
1686
  break;
1530
1687
  }
1531
- case 31: {
1688
+ case 32: {
1532
1689
  const activePatternResult_16 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1533
1690
  if (activePatternResult_16 != null) {
1534
- matchResult = 19;
1691
+ matchResult = 20;
1535
1692
  name_1 = activePatternResult_16;
1536
1693
  }
1537
1694
  else {
1538
- matchResult = 37;
1695
+ matchResult = 38;
1539
1696
  }
1540
1697
  break;
1541
1698
  }
1542
- case 32: {
1699
+ case 33: {
1543
1700
  const activePatternResult_17 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1544
1701
  if (activePatternResult_17 != null) {
1545
- matchResult = 19;
1702
+ matchResult = 20;
1546
1703
  name_1 = activePatternResult_17;
1547
1704
  }
1548
1705
  else {
1549
- matchResult = 37;
1706
+ matchResult = 38;
1550
1707
  }
1551
1708
  break;
1552
1709
  }
1553
1710
  case 4: {
1554
1711
  const activePatternResult_18 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1555
1712
  if (activePatternResult_18 != null) {
1556
- matchResult = 19;
1713
+ matchResult = 20;
1557
1714
  name_1 = activePatternResult_18;
1558
1715
  }
1559
1716
  else {
1560
- matchResult = 37;
1717
+ matchResult = 38;
1561
1718
  }
1562
1719
  break;
1563
1720
  }
@@ -1567,45 +1724,47 @@ function transformType(context_mut, glueType_mut) {
1567
1724
  switch (matchResult) {
1568
1725
  case 0:
1569
1726
  return FSharpType.Object$;
1570
- case 1: {
1727
+ case 1:
1728
+ return transformClassConstructor(context, reference);
1729
+ case 2: {
1571
1730
  context_mut = context;
1572
1731
  glueType_mut = (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(singleton(new GlueMember(/* ConstructSignature */ 7, [constructSignature])), undefined)]));
1573
1732
  continue transformType;
1574
1733
  }
1575
- case 2:
1576
- return new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]);
1577
1734
  case 3:
1578
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1735
+ return new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]);
1579
1736
  case 4:
1580
- return new FSharpType(/* Option */ 3, [transformType(context, glueType_21)]);
1737
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1581
1738
  case 5:
1582
- return new FSharpType(/* ThisType */ 15, [new FSharpThisType(sanitizeTypeName(thisTypeInfo.Name), declaredTypeParameters_1(map((_arg) => _arg.Name, thisTypeInfo.TypeParameters)))]);
1739
+ return new FSharpType(/* Option */ 3, [transformType(context, glueType_21)]);
1583
1740
  case 6:
1584
- return transformTupleType(context, glueTypes);
1741
+ return new FSharpType(/* ThisType */ 15, [new FSharpThisType(sanitizeTypeName(thisTypeInfo.Name), declaredTypeParameters_1(map((_arg) => _arg.Name, thisTypeInfo.TypeParameters)))]);
1585
1742
  case 7:
1586
- return transformReadOnlyModifier(context, glueType_22);
1743
+ return transformTupleType(context, glueTypes);
1587
1744
  case 8:
1588
- return transformUnionType(context, cases);
1745
+ return transformReadOnlyModifier(context, glueType_22);
1589
1746
  case 9:
1590
- return FSharpType.Object$;
1747
+ return transformUnionType(context, cases);
1591
1748
  case 10:
1592
1749
  return FSharpType.Object$;
1593
- case 11: {
1750
+ case 11:
1751
+ return FSharpType.Object$;
1752
+ case 12: {
1594
1753
  context_mut = context;
1595
1754
  glueType_mut = argument;
1596
1755
  continue transformType;
1597
1756
  }
1598
- case 12:
1599
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference_4), typeReference_4.FullName, typeReference_4.ModulePath, (typeReference_4.IsStandardLibrary && FSharpSet__Contains(typedArrayNames, typeReference_4.Name)) ? empty() : ((typeReference_4.IsStandardLibrary && FSharpSet__Contains(iteratorNames, typeReference_4.Name)) ? map((glueType_23) => transformType(context, glueType_23), truncate(1, typeReference_4.TypeArguments)) : map((glueType_24) => transformType(context, glueType_24), typeReference_4.TypeArguments)), FSharpType.Discard)]);
1600
1757
  case 13:
1601
- return new FSharpType(/* ResizeArray */ 14, [transformType(TransformContext__PushScope_27AED5E3(context, "Item"), glueType_25)]);
1758
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference_4), typeReference_4.FullName, typeReference_4.ModulePath, (typeReference_4.IsStandardLibrary && FSharpSet__Contains(typedArrayNames, typeReference_4.Name)) ? empty() : ((typeReference_4.IsStandardLibrary && FSharpSet__Contains(iteratorNames, typeReference_4.Name)) ? map((glueType_23) => transformType(context, glueType_23), truncate(1, typeReference_4.TypeArguments)) : map((glueType_24) => transformType(context, glueType_24), typeReference_4.TypeArguments)), FSharpType.Discard)]);
1602
1759
  case 14:
1603
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), empty(), FSharpType.Discard)]);
1760
+ return new FSharpType(/* ResizeArray */ 14, [transformType(TransformContext__PushScope_27AED5E3(context, "Item"), glueType_25)]);
1604
1761
  case 15:
1605
- return new FSharpType(/* TypeParameter */ 13, [name]);
1762
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), empty(), FSharpType.Discard)]);
1606
1763
  case 16:
1764
+ return new FSharpType(/* TypeParameter */ 13, [name]);
1765
+ case 17:
1607
1766
  return transformFunctionType(context, functionTypeInfo);
1608
- case 17: {
1767
+ case 18: {
1609
1768
  const matchValue = tryTransformCallableInterface(context, interfaceInfo);
1610
1769
  if (matchValue == null) {
1611
1770
  return new FSharpType(/* Interface */ 5, [transformInterface(context, interfaceInfo)]);
@@ -1614,40 +1773,44 @@ function transformType(context_mut, glueType_mut) {
1614
1773
  return matchValue;
1615
1774
  }
1616
1775
  }
1617
- case 18:
1618
- return FSharpType.Object$;
1619
1776
  case 19:
1620
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(name_1, TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1777
+ return FSharpType.Object$;
1621
1778
  case 20:
1779
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(name_1, TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1780
+ case 21:
1622
1781
  return transformTypeLiteral(context, typeLiteralInfo);
1623
- case 21: {
1782
+ case 22: {
1624
1783
  context_mut = context;
1625
1784
  glueType_mut = glueType_26;
1626
1785
  continue transformType;
1627
1786
  }
1628
- case 22: {
1787
+ case 23: {
1629
1788
  context_mut = context;
1630
1789
  glueType_mut = info.Type;
1631
1790
  continue transformType;
1632
1791
  }
1633
- case 23: {
1792
+ case 24: {
1634
1793
  const matchValue_1 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), innerGlueType);
1635
1794
  if (matchValue_1 == null) {
1636
1795
  return FSharpType.Object$;
1637
1796
  }
1638
1797
  else {
1639
- TransformContext__ExposeType_Z1D58A540(context, matchValue_1);
1640
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1798
+ const name_2 = TransformContext__NewTypeName(context);
1799
+ const option_1 = TypeAliasDeclaration_tryTransformKeyOf(name_2, innerGlueType);
1800
+ if (option_1 != null) {
1801
+ TransformContext__ExposeType_Z1D58A540(context, option_1);
1802
+ }
1803
+ return referenceToExposed(context, name_2, empty());
1641
1804
  }
1642
1805
  }
1643
- case 24: {
1806
+ case 25: {
1644
1807
  context_mut = context;
1645
1808
  glueType_mut = namedTupleType.Type;
1646
1809
  continue transformType;
1647
1810
  }
1648
- case 25:
1649
- return FSharpType.Object$;
1650
1811
  case 26:
1812
+ return FSharpType.Object$;
1813
+ case 27:
1651
1814
  switch (glueLiteral.tag) {
1652
1815
  case 1:
1653
1816
  return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Int]);
@@ -1660,26 +1823,26 @@ function transformType(context_mut, glueType_mut) {
1660
1823
  default:
1661
1824
  return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1662
1825
  }
1663
- case 27:
1664
- return FSharpType.Object$;
1665
1826
  case 28:
1666
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter) => transformParameter(context, parameter), functionDeclaration_2.Parameters)), transformType(context, functionDeclaration_2.Type))]);
1827
+ return FSharpType.Object$;
1667
1828
  case 29:
1668
- return transformIntersectionOfReferences(context, references, members);
1829
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter) => transformParameter(context, parameter), functionDeclaration_2.Parameters)), transformType(context, functionDeclaration_2.Type))]);
1669
1830
  case 30:
1670
- return transformIntersectionType(context, members_1);
1831
+ return transformIntersectionOfReferences(context, references, members);
1671
1832
  case 31:
1672
- return UtilityType_transform(context, utilityType);
1833
+ return transformIntersectionType(context, members_1);
1673
1834
  case 32:
1674
- return new FSharpType(/* Mapped */ 7, [new FSharpMapped(typeAliasDeclaration.Name, empty())]);
1835
+ return UtilityType_transform(context, utilityType);
1675
1836
  case 33:
1676
- return transformMappedType(context, mappedType);
1837
+ return new FSharpType(/* Mapped */ 7, [new FSharpMapped(typeAliasDeclaration.Name, empty())]);
1677
1838
  case 34:
1678
- return FSharpType.Object$;
1839
+ return transformMappedType(context, mappedType);
1679
1840
  case 35:
1680
1841
  return FSharpType.Object$;
1681
1842
  case 36:
1682
1843
  return FSharpType.Object$;
1844
+ case 37:
1845
+ return FSharpType.Object$;
1683
1846
  default: {
1684
1847
  TransformContext__AddError_Z721C83C5(context, `Could not transform type: ${interpolate("%A%P()", [glueType])}`);
1685
1848
  return FSharpType.Discard;
@@ -1694,7 +1857,7 @@ function transformParameter(context, parameter) {
1694
1857
  const parameter_1 = new GlueParameter(parameter.Name, parameter.IsOptional, parameter.IsSpread, arrayAsInput(parameter.Type));
1695
1858
  let typ;
1696
1859
  const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter_1.Type, parameter_1.IsOptional);
1697
- typ = (parameter_1.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : ((computedType.tag === 11) ? ((computedType.fields[0].Name === "ResizeArray") ? (!isEmpty(computedType.fields[0].TypeArguments) ? (isEmpty(tail_1(computedType.fields[0].TypeArguments)) ? head_1(computedType.fields[0].TypeArguments) : computedType) : computedType) : computedType) : computedType)) : computedType);
1860
+ typ = (parameter_1.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : ((computedType.tag === 11) ? ((computedType.fields[0].Name === "ResizeArray") ? (!isEmpty(computedType.fields[0].TypeArguments) ? (isEmpty(tail_1(computedType.fields[0].TypeArguments)) ? head_1(computedType.fields[0].TypeArguments) : FSharpType.Object$) : FSharpType.Object$) : FSharpType.Object$) : ((computedType.tag === 19) ? computedType.fields[0].fields[0] : FSharpType.Object$))) : computedType);
1698
1861
  return new FSharpParameter(toList(delay(() => (parameter_1.IsSpread ? singleton_1(FSharpAttribute.ParamArray) : empty_1()))), patternInput[0], parameter_1.IsOptional, typ, undefined);
1699
1862
  }
1700
1863
 
@@ -2604,6 +2767,8 @@ function paramObjectParameters(context, members) {
2604
2767
  const info = _arg.fields[0];
2605
2768
  return new GlueMember(/* Property */ 1, [new GlueProperty(info.Name, info.Documentation, arrayAsInput(info.Type), info.IsStatic, info.IsOptional, info.Accessor, info.IsPrivate)]);
2606
2769
  }
2770
+ case 6:
2771
+ return methodAsProperty(_arg);
2607
2772
  default:
2608
2773
  return _arg;
2609
2774
  }
@@ -2764,13 +2929,64 @@ function paramObjectParameterSets(context, members) {
2764
2929
  }
2765
2930
  }
2766
2931
  }, parameters) : parameters;
2767
- return defaultArg(tryParameterCombinations(TransformContext__get_State(context).MaxOverloads, expandable), singleton(parameters));
2932
+ return defaultArg(tryParameterCombinations(min(TransformContext__get_State(context).MaxOverloads, ~~((TransformContext__get_State(context).MaxOverloads * 16) / max(1, length(parameters)))), expandable), singleton(parameters));
2768
2933
  }
2769
2934
 
2770
2935
  function paramObjectCreateMembers(context, returnType, members) {
2771
2936
  return map((parameters) => (new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(ofArray([FSharpAttribute.ParamObject, FSharpAttribute.EmitSelf]), "Create", "Create", empty(), requiredBeforeParamArray(parameters), returnType, false, true, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)])), paramObjectParameterSets(context, members));
2772
2937
  }
2773
2938
 
2939
+ function dictionaryCreateMembers(context, returnType, members) {
2940
+ let glueType, matchValue;
2941
+ let matchResult, valueType;
2942
+ if (!isEmpty(members)) {
2943
+ if (head_1(members).tag === 5) {
2944
+ if (!isEmpty(head_1(members).fields[0].Parameters)) {
2945
+ if (head_1(head_1(members).fields[0].Parameters).Type.tag === 3) {
2946
+ if (head_1(head_1(members).fields[0].Parameters).Type.fields[0].tag === 0) {
2947
+ if (isEmpty(tail_1(head_1(members).fields[0].Parameters))) {
2948
+ if (head_1(members).fields[0].IsReadOnly) {
2949
+ matchResult = 1;
2950
+ }
2951
+ else if (isEmpty(tail_1(members))) {
2952
+ matchResult = 0;
2953
+ valueType = head_1(members).fields[0].Type;
2954
+ }
2955
+ else {
2956
+ matchResult = 1;
2957
+ }
2958
+ }
2959
+ else {
2960
+ matchResult = 1;
2961
+ }
2962
+ }
2963
+ else {
2964
+ matchResult = 1;
2965
+ }
2966
+ }
2967
+ else {
2968
+ matchResult = 1;
2969
+ }
2970
+ }
2971
+ else {
2972
+ matchResult = 1;
2973
+ }
2974
+ }
2975
+ else {
2976
+ matchResult = 1;
2977
+ }
2978
+ }
2979
+ else {
2980
+ matchResult = 1;
2981
+ }
2982
+ switch (matchResult) {
2983
+ case 0:
2984
+ return singleton(new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(new FSharpAttribute(/* Text */ 0, ["Emit(\"Object.fromEntries($0)\")"])), "Create", "Create", empty(), singleton(new FSharpParameter(empty(), "entries", false, new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference("seq", "", empty(), singleton(new FSharpType(/* Tuple */ 12, [ofArray([new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]), transformType(TransformContext__PushScope_27AED5E3(context, "Item"), arrayAsInput((glueType = valueType, (glueType.tag === 7) ? ((matchValue = filter((y) => !equals(new GlueType(/* Primitive */ 3, [GluePrimitive.Undefined]), y), glueType.fields[0].fields[0]), !isEmpty(matchValue) ? (isEmpty(tail_1(matchValue)) ? head_1(matchValue) : (new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue)]))) : (new GlueType(/* Union */ 7, [new GlueTypeUnion(matchValue)])))) : glueType)))])])), FSharpType.Discard)]), undefined)), returnType, false, true, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)]));
2985
+ default:
2986
+ return empty();
2987
+ }
2988
+ }
2989
+
2774
2990
  function transformParamObjectClass(context, name, documentation, members) {
2775
2991
  const xmlDocInfo = transformComment(documentation);
2776
2992
  const typeParameterNames = List_distinct(collect(memberTypeParameterNames, members), {
@@ -2798,7 +3014,7 @@ function transformParamObjectClass(context, name, documentation, members) {
2798
3014
  function arrayAsInput(glueType) {
2799
3015
  let matchResult, elementType, elementType_1, cases, glueType_2, glueType_3;
2800
3016
  switch (glueType.tag) {
2801
- case 30: {
3017
+ case 31: {
2802
3018
  if (glueType.fields[0].tag === 14) {
2803
3019
  matchResult = 0;
2804
3020
  elementType = glueType.fields[0].fields[0];
@@ -2894,6 +3110,28 @@ function transformCallbackReturnType(context, returnType) {
2894
3110
  }
2895
3111
  }
2896
3112
 
3113
+ function transformOwnCallbackReturnType(context, ownDefaults, returnType) {
3114
+ let matchResult, name_1;
3115
+ if (returnType.tag === 16) {
3116
+ if (FSharpMap__ContainsKey(ownDefaults, returnType.fields[0])) {
3117
+ matchResult = 0;
3118
+ name_1 = returnType.fields[0];
3119
+ }
3120
+ else {
3121
+ matchResult = 1;
3122
+ }
3123
+ }
3124
+ else {
3125
+ matchResult = 1;
3126
+ }
3127
+ switch (matchResult) {
3128
+ case 0:
3129
+ return transformType(context, arrayAsInput(FSharpMap__get_Item(ownDefaults, name_1)));
3130
+ default:
3131
+ return transformCallbackReturnType(context, GlueSubstitution_substitute(ownDefaults, returnType));
3132
+ }
3133
+ }
3134
+
2897
3135
  function tryTransformCallableInterface(context, info) {
2898
3136
  const isDeclaredOnce = length(filter((_arg) => {
2899
3137
  if (_arg.tag === 1) {
@@ -2934,7 +3172,7 @@ function tryTransformCallableInterface(context, info) {
2934
3172
  else if (head_1(matchValue).tag === 4) {
2935
3173
  if (isEmpty(tail_1(matchValue))) {
2936
3174
  if (isEmpty(matchValue_1)) {
2937
- if (isDeclaredOnce) {
3175
+ if (isDeclaredOnce && isEmpty(head_1(matchValue).fields[0].TypeParameters)) {
2938
3176
  matchResult = 0;
2939
3177
  callSignature_1 = head_1(matchValue).fields[0];
2940
3178
  }
@@ -2987,10 +3225,14 @@ function tryTransformCallableInterface(context, info) {
2987
3225
  }
2988
3226
 
2989
3227
  function transformInterface(context, info) {
2990
- let members_2, typeMemory_1, ownNames;
3228
+ let members_3, typeMemory_1, ownNames;
2991
3229
  let info_1;
2992
- const patternInput = withoutRedeclaredBases(TransformContext__get_TypeMemory(context), info.Members, info.HeritageClauses);
2993
- info_1 = (new GlueInterface(info.Documentation, info.FullName, info.Name, (members_2 = asMethods(TransformContext__get_TypeMemory(context), patternInput[1]), resolveMembers(TransformContext__get_State(context).Conditionals, members_2)), info.TypeParameters, patternInput[0]));
3230
+ const thisType = new GlueThisType(info.Name, info.TypeParameters);
3231
+ const patternInput = withoutRedeclaredBases(TransformContext__get_TypeMemory(context), thisType, info.Members, info.HeritageClauses);
3232
+ const members = patternInput[1];
3233
+ const heritageClauses = patternInput[0];
3234
+ const members_1 = append(members, thisMembersOfBases(TransformContext__get_TypeMemory(context), thisType, members, heritageClauses));
3235
+ info_1 = (new GlueInterface(info.Documentation, info.FullName, info.Name, (members_3 = asMethods(TransformContext__get_TypeMemory(context), members_1), resolveMembers(TransformContext__get_State(context).Conditionals, members_3)), info.TypeParameters, heritageClauses));
2994
3236
  const patternInput_1 = sanitizeTypeNameAndPushScope(info_1.Name, context);
2995
3237
  const name = patternInput_1[0];
2996
3238
  const context_1 = patternInput_1[1];
@@ -3030,7 +3272,7 @@ function transformInterface(context, info) {
3030
3272
  const typeReference = heritageClause.fields[0];
3031
3273
  if (typeReference.IsStandardLibrary && (typeReference.Name === "Partial")) {
3032
3274
  if (length(typeReference.TypeArguments) === 1) {
3033
- const matchValue = item(0, typeReference.TypeArguments);
3275
+ const matchValue = item_1(0, typeReference.TypeArguments);
3034
3276
  if (matchValue.tag === 13) {
3035
3277
  return matchValue.fields[0].FullName;
3036
3278
  }
@@ -3051,17 +3293,17 @@ function transformInterface(context, info) {
3051
3293
  }
3052
3294
  }, map((typ) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ), info_1.HeritageClauses))));
3053
3295
  const membersComingFromOmit = collect((heritageClause_1) => {
3054
- let matchResult, members_3;
3296
+ let matchResult, members_4;
3055
3297
  if (heritageClause_1.tag === 27) {
3056
3298
  switch (heritageClause_1.fields[0].tag) {
3057
3299
  case 4: {
3058
3300
  matchResult = 0;
3059
- members_3 = heritageClause_1.fields[0].fields[0];
3301
+ members_4 = heritageClause_1.fields[0].fields[0];
3060
3302
  break;
3061
3303
  }
3062
3304
  case 5: {
3063
3305
  matchResult = 0;
3064
- members_3 = heritageClause_1.fields[0].fields[0];
3306
+ members_4 = heritageClause_1.fields[0].fields[0];
3065
3307
  break;
3066
3308
  }
3067
3309
  default:
@@ -3073,7 +3315,7 @@ function transformInterface(context, info) {
3073
3315
  }
3074
3316
  switch (matchResult) {
3075
3317
  case 0:
3076
- return TransformMembers_toFSharpMember(context_1, members_3);
3318
+ return TransformMembers_toFSharpMember(context_1, members_4);
3077
3319
  default:
3078
3320
  return empty();
3079
3321
  }
@@ -3385,11 +3627,13 @@ function TypeParameterTransform_transformWith(withDefault, context, typeParamete
3385
3627
  return TransformResult_Create_403667D8(typeParameter.Name, default_);
3386
3628
  case 1: {
3387
3629
  const matchValue_1 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType);
3388
- if (matchValue_1.tag === 11) {
3389
- return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3390
- }
3391
- else {
3392
- return TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3630
+ switch (matchValue_1.tag) {
3631
+ case 11:
3632
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3633
+ case 18:
3634
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3635
+ default:
3636
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3393
3637
  }
3394
3638
  }
3395
3639
  case 2:
@@ -3402,9 +3646,13 @@ function TypeParameterTransform_transformWith(withDefault, context, typeParamete
3402
3646
  matchResult_1 = 0;
3403
3647
  break;
3404
3648
  }
3649
+ case 18: {
3650
+ matchResult_1 = 1;
3651
+ break;
3652
+ }
3405
3653
  case 19:
3406
3654
  case 14: {
3407
- matchResult_1 = 2;
3655
+ matchResult_1 = 3;
3408
3656
  break;
3409
3657
  }
3410
3658
  case 11: {
@@ -3412,34 +3660,41 @@ function TypeParameterTransform_transformWith(withDefault, context, typeParamete
3412
3660
  matchResult_1 = 0;
3413
3661
  }
3414
3662
  else {
3415
- matchResult_1 = 2;
3663
+ matchResult_1 = 3;
3416
3664
  }
3417
3665
  break;
3418
3666
  }
3419
3667
  case 8: {
3420
- matchResult_1 = 1;
3421
- fsharpType_2 = matchValue_2;
3668
+ if (matchValue_2.fields[0].tag === 6) {
3669
+ matchResult_1 = 1;
3670
+ }
3671
+ else {
3672
+ matchResult_1 = 2;
3673
+ fsharpType_2 = matchValue_2;
3674
+ }
3422
3675
  break;
3423
3676
  }
3424
3677
  case 3: {
3425
- matchResult_1 = 1;
3678
+ matchResult_1 = 2;
3426
3679
  fsharpType_2 = matchValue_2;
3427
3680
  break;
3428
3681
  }
3429
3682
  case 1: {
3430
- matchResult_1 = 1;
3683
+ matchResult_1 = 2;
3431
3684
  fsharpType_2 = matchValue_2;
3432
3685
  break;
3433
3686
  }
3434
3687
  default:
3435
- matchResult_1 = 3;
3688
+ matchResult_1 = 4;
3436
3689
  }
3437
3690
  switch (matchResult_1) {
3438
3691
  case 0:
3439
3692
  return TransformResult_Create_403667D8(typeParameter.Name, default_);
3440
3693
  case 1:
3441
- return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3694
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3442
3695
  case 2:
3696
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3697
+ case 3:
3443
3698
  return TransformResult_Create_403667D8(typeParameter.Name, default_);
3444
3699
  default:
3445
3700
  return TransformResult_Create_403667D8(typeParameter.Name, default_);
@@ -3573,7 +3828,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
3573
3828
  }
3574
3829
  }, aliasCases_1);
3575
3830
  if (forAll((option) => (option != null), resolved)) {
3576
- return collect(value_7, resolved);
3831
+ return collect(value_8, resolved);
3577
3832
  }
3578
3833
  else {
3579
3834
  return undefined;
@@ -3713,8 +3968,8 @@ function tryOptimizeUnionType(context, typeName, cases) {
3713
3968
  return singleton(case$);
3714
3969
  }
3715
3970
  }, cases_4) : cases_4)), forAll(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
3716
- const otherCases = patternInput[1];
3717
3971
  const flattenedCases = patternInput[0];
3972
+ const otherCases_1 = withoutAliasesOfSamePrimitive(context, patternInput[1]);
3718
3973
  const isStringEnumCompatible = (!isEmpty(flattenedCases) && exists((_arg_5) => {
3719
3974
  let matchResult_5;
3720
3975
  if (_arg_5.tag === 8) {
@@ -3808,7 +4063,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
3808
4063
  const patternInput_1 = nextName(tupledArg[0]);
3809
4064
  const name_1 = patternInput_1[1];
3810
4065
  return [patternInput_1[0] + 1, cons(new FSharpUnionCase(/* Field */ 2, [name_1, transformType(TransformContext__PushScope_27AED5E3(TransformContext__PushScope_27AED5E3(context, "Cases"), name_1), caseType)]), tupledArg[1])];
3811
- }, [1, empty()], otherCases)[1]);
4066
+ }, [1, empty()], otherCases_1)[1]);
3812
4067
  };
3813
4068
  const literalCaseInfo = (literal_2) => {
3814
4069
  switch (literal_2.tag) {
@@ -3868,33 +4123,38 @@ function tryOptimizeUnionType(context, typeName, cases) {
3868
4123
  }), caseInfos)[0];
3869
4124
  let matchValue_3;
3870
4125
  const casesProperties = map((_arg_10) => {
3871
- if (_arg_10.tag === 22) {
3872
- const properties = map((_arg_11) => {
3873
- if (_arg_11.tag === 1) {
3874
- return _arg_11.fields[0];
4126
+ switch (_arg_10.tag) {
4127
+ case 22: {
4128
+ const properties = map((_arg_11) => {
4129
+ if (_arg_11.tag === 1) {
4130
+ return _arg_11.fields[0];
4131
+ }
4132
+ else {
4133
+ return undefined;
4134
+ }
4135
+ }, _arg_10.fields[0].Members);
4136
+ if (forAll((option_2) => (option_2 != null), properties)) {
4137
+ return choose((x_2) => x_2, properties);
3875
4138
  }
3876
4139
  else {
3877
4140
  return undefined;
3878
4141
  }
3879
- }, _arg_10.fields[0].Members);
3880
- if (forAll((option_2) => (option_2 != null), properties)) {
3881
- return choose((x_2) => x_2, properties);
3882
4142
  }
3883
- else {
4143
+ case 13:
4144
+ return tryAllProperties(TransformContext__get_TypeMemory(context), empty_3({
4145
+ Compare: (x_3, y_2) => (comparePrimitives(x_3, y_2) | 0),
4146
+ }), _arg_10.fields[0]);
4147
+ default:
3884
4148
  return undefined;
3885
- }
3886
4149
  }
3887
- else {
3888
- return undefined;
3889
- }
3890
- }, otherCases);
4150
+ }, otherCases_1);
3891
4151
  if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll((option_3) => (option_3 != null), casesProperties)) {
3892
- const casesProperties_1 = choose((x_3) => x_3, casesProperties);
4152
+ const casesProperties_1 = choose((x_4) => x_4, casesProperties);
3893
4153
  matchValue_3 = tryPick((candidate_1) => {
3894
4154
  const tagValues = map((properties_1) => {
3895
- const option_5 = tryFind((property_1) => (property_1.Name === candidate_1.Name), properties_1);
3896
- if (option_5 != null) {
3897
- const property_2 = option_5;
4155
+ const option_7 = tryFind((property_1) => (property_1.Name === candidate_1.Name), properties_1);
4156
+ if (option_7 != null) {
4157
+ const property_2 = option_7;
3898
4158
  const matchValue_2 = property_2.Type;
3899
4159
  let matchResult_8, literal_6;
3900
4160
  if (matchValue_2.tag === 8) {
@@ -3938,20 +4198,70 @@ function tryOptimizeUnionType(context, typeName, cases) {
3938
4198
  }
3939
4199
  switch (matchResult_8) {
3940
4200
  case 0:
3941
- return literal_6;
3942
- default:
3943
- return undefined;
4201
+ return [literal_6, undefined];
4202
+ default: {
4203
+ let matchResult_9, typeReference_6;
4204
+ if (matchValue_2.tag === 13) {
4205
+ if (!property_2.IsOptional) {
4206
+ matchResult_9 = 0;
4207
+ typeReference_6 = matchValue_2.fields[0];
4208
+ }
4209
+ else {
4210
+ matchResult_9 = 1;
4211
+ }
4212
+ }
4213
+ else {
4214
+ matchResult_9 = 1;
4215
+ }
4216
+ switch (matchResult_9) {
4217
+ case 0: {
4218
+ const typeReference_4 = typeReference_6;
4219
+ const memberName = last(split(typeReference_4.FullName, ["."], undefined, 0));
4220
+ return tryPick((_arg_12) => {
4221
+ let enumMember_1;
4222
+ let matchResult_10, enumInfo_1;
4223
+ if (_arg_12.tag === 4) {
4224
+ if ((_arg_12.fields[0].Name === typeReference_4.Name) && (memberName !== typeReference_4.Name)) {
4225
+ matchResult_10 = 0;
4226
+ enumInfo_1 = _arg_12.fields[0];
4227
+ }
4228
+ else {
4229
+ matchResult_10 = 1;
4230
+ }
4231
+ }
4232
+ else {
4233
+ matchResult_10 = 1;
4234
+ }
4235
+ switch (matchResult_10) {
4236
+ case 0: {
4237
+ const option_5 = tryFind((enumMember) => (enumMember.Name === memberName), enumInfo_1.Members);
4238
+ if (option_5 != null) {
4239
+ return (enumMember_1 = option_5, [enumMember_1.Value, enumMember_1.Name]);
4240
+ }
4241
+ else {
4242
+ return undefined;
4243
+ }
4244
+ }
4245
+ default:
4246
+ return undefined;
4247
+ }
4248
+ }, TransformContext__get_TypeMemory(context));
4249
+ }
4250
+ default:
4251
+ return undefined;
4252
+ }
4253
+ }
3944
4254
  }
3945
4255
  }
3946
4256
  else {
3947
4257
  return undefined;
3948
4258
  }
3949
4259
  }, casesProperties_1);
3950
- if (forAll((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
4260
+ if (forAll((option_8) => (option_8 != null), tagValues) && (length(List_distinct(tagValues, {
3951
4261
  Equals: equals,
3952
- GetHashCode: (x_4) => (structuralHash(x_4) | 0),
4262
+ GetHashCode: (x_5) => (structuralHash(x_5) | 0),
3953
4263
  })) === length(tagValues))) {
3954
- return [candidate_1.Name, zip(choose((x_5) => x_5, tagValues), casesProperties_1)];
4264
+ return [candidate_1.Name, zip(choose((x_6) => x_6, tagValues), casesProperties_1)];
3955
4265
  }
3956
4266
  else {
3957
4267
  return undefined;
@@ -3963,71 +4273,71 @@ function tryOptimizeUnionType(context, typeName, cases) {
3963
4273
  }
3964
4274
  if (matchValue_3 == null) {
3965
4275
  if (isStringEnumCompatible) {
3966
- const literalCases_1 = map((Item_2) => (new FSharpUnionCase(/* Named */ 0, [Item_2])), deduplicateCaseNames(List_distinct(map((_arg_13) => {
3967
- if (_arg_13.tag === 8) {
3968
- return literalCaseInfo(_arg_13.fields[0]);
4276
+ const literalCases_1 = map((Item_3) => (new FSharpUnionCase(/* Named */ 0, [Item_3])), deduplicateCaseNames(List_distinct(map((_arg_15) => {
4277
+ if (_arg_15.tag === 8) {
4278
+ return literalCaseInfo(_arg_15.fields[0]);
3969
4279
  }
3970
4280
  else {
3971
4281
  throw new Exception("Should not happen");
3972
4282
  }
3973
4283
  }, flattenedCases), {
3974
4284
  Equals: equals,
3975
- GetHashCode: (x_6) => (safeHash(x_6) | 0),
4285
+ GetHashCode: (x_7) => (safeHash(x_7) | 0),
3976
4286
  })));
3977
4287
  const fieldCases_1 = transformFieldCases(literalCases_1);
3978
4288
  return new FSharpType(/* Union */ 1, [new FSharpUnion(toList(delay(() => append_1(singleton_1(FSharpAttribute.RequireQualifiedAccess), delay(() => (isEmpty(fieldCases_1) ? singleton_1(new FSharpAttribute(/* StringEnum */ 12, [0])) : singleton_1(new FSharpAttribute(/* EraseWithCaseRules */ 7, [0]))))))), typeName, append(literalCases_1, fieldCases_1), false, empty(), empty(), empty())]);
3979
4289
  }
3980
- else if (isNumericOnly && !isEmpty(otherCases)) {
3981
- const literalCases_2 = List_distinct(map((value_3) => {
3982
- let matchResult_9, value_4;
3983
- if (value_3.tag === 8) {
3984
- if (value_3.fields[0].tag === 1) {
3985
- matchResult_9 = 0;
3986
- value_4 = value_3.fields[0].fields[0];
4290
+ else if (isNumericOnly && !isEmpty(otherCases_1)) {
4291
+ const literalCases_2 = List_distinct(map((value_4) => {
4292
+ let matchResult_11, value_5;
4293
+ if (value_4.tag === 8) {
4294
+ if (value_4.fields[0].tag === 1) {
4295
+ matchResult_11 = 0;
4296
+ value_5 = value_4.fields[0].fields[0];
3987
4297
  }
3988
4298
  else {
3989
- matchResult_9 = 1;
4299
+ matchResult_11 = 1;
3990
4300
  }
3991
4301
  }
3992
4302
  else {
3993
- matchResult_9 = 1;
4303
+ matchResult_11 = 1;
3994
4304
  }
3995
- switch (matchResult_9) {
4305
+ switch (matchResult_11) {
3996
4306
  case 0:
3997
- return new FSharpUnionCase(/* Named */ 0, [new FSharpUnionCaseNamed(singleton(new FSharpAttribute(/* CompiledValue */ 14, [new FSharpLiteral(/* Int */ 1, [value_4])])), `\`\`${value_4}\`\``)]);
4307
+ return new FSharpUnionCase(/* Named */ 0, [new FSharpUnionCaseNamed(singleton(new FSharpAttribute(/* CompiledValue */ 14, [new FSharpLiteral(/* Int */ 1, [value_5])])), `\`\`${value_5}\`\``)]);
3998
4308
  default:
3999
4309
  throw new Exception("Should not happen");
4000
4310
  }
4001
4311
  }, flattenedCases), {
4002
4312
  Equals: equals,
4003
- GetHashCode: (x_7) => (safeHash(x_7) | 0),
4313
+ GetHashCode: (x_8) => (safeHash(x_8) | 0),
4004
4314
  });
4005
4315
  return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* EraseWithCaseRules */ 7, [0])]), typeName, append(literalCases_2, transformFieldCases(literalCases_2)), false, empty(), empty(), empty())]);
4006
4316
  }
4007
4317
  else if (isNumericOnly) {
4008
- return new FSharpType(/* Enum */ 0, [new FSharpEnum(typeName, List_distinct(map((value_5) => {
4009
- let matchResult_10, value_6;
4010
- if (value_5.tag === 8) {
4011
- if (value_5.fields[0].tag === 1) {
4012
- matchResult_10 = 0;
4013
- value_6 = value_5.fields[0].fields[0];
4318
+ return new FSharpType(/* Enum */ 0, [new FSharpEnum(typeName, List_distinct(map((value_6) => {
4319
+ let matchResult_12, value_7;
4320
+ if (value_6.tag === 8) {
4321
+ if (value_6.fields[0].tag === 1) {
4322
+ matchResult_12 = 0;
4323
+ value_7 = value_6.fields[0].fields[0];
4014
4324
  }
4015
4325
  else {
4016
- matchResult_10 = 1;
4326
+ matchResult_12 = 1;
4017
4327
  }
4018
4328
  }
4019
4329
  else {
4020
- matchResult_10 = 1;
4330
+ matchResult_12 = 1;
4021
4331
  }
4022
- switch (matchResult_10) {
4332
+ switch (matchResult_12) {
4023
4333
  case 0:
4024
- return new FSharpEnumCase((value_6 < 0) ? (`_MINUS_${op_UnaryNegation_Int32(value_6)}`) : int32ToString(value_6), new FSharpLiteral(/* Int */ 1, [value_6]));
4334
+ return new FSharpEnumCase((value_7 < 0) ? (`_MINUS_${op_UnaryNegation_Int32(value_7)}`) : int32ToString(value_7), new FSharpLiteral(/* Int */ 1, [value_7]));
4025
4335
  default:
4026
4336
  throw new Exception("Should not happen");
4027
4337
  }
4028
4338
  }, flattenedCases), {
4029
4339
  Equals: equals,
4030
- GetHashCode: (x_8) => (safeHash(x_8) | 0),
4340
+ GetHashCode: (x_9) => (safeHash(x_9) | 0),
4031
4341
  }))]);
4032
4342
  }
4033
4343
  else {
@@ -4037,16 +4347,39 @@ function tryOptimizeUnionType(context, typeName, cases) {
4037
4347
  else {
4038
4348
  const taggedCases = matchValue_3[1];
4039
4349
  const tagName_1 = matchValue_3[0];
4040
- const cases_6 = map((tupledArg_1) => {
4041
- const caseInfo_2 = tupledArg_1[0];
4350
+ const cases_6 = map((tupledArg_2) => {
4351
+ const caseInfo_2 = tupledArg_2[0];
4042
4352
  const caseContext = TransformContext__PushScope_27AED5E3(TransformContext__PushScope_27AED5E3(context, "Cases"), trim(caseInfo_2.Name, "`"));
4043
4353
  return new FSharpUnionCase(/* NamedFields */ 3, [caseInfo_2, map((property_4) => {
4044
- let matchValue_4;
4354
+ let matchValue_5;
4045
4355
  const patternInput_2 = sanitizeNameAndPushScope(property_4.Name, caseContext);
4046
- return [patternInput_2[0], (matchValue_4 = transformType(patternInput_2[1], property_4.Type), (matchValue_4.tag === 3) ? matchValue_4 : (property_4.IsOptional ? (new FSharpType(/* Option */ 3, [matchValue_4])) : matchValue_4))];
4047
- }, filter((property_3) => (property_3.Name !== tagName_1), tupledArg_1[1][1]))]);
4048
- }, zip(deduplicateCaseNames(map((arg) => literalCaseInfo(arg[0]), taggedCases)), taggedCases));
4049
- return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* TypeScriptTaggedUnion */ 8, [removeSurroundingQuotes(tagName_1), 0])]), typeName, cases_6, false, empty(), empty(), empty())]);
4356
+ return [patternInput_2[0], (matchValue_5 = transformType(patternInput_2[1], property_4.Type), (matchValue_5.tag === 3) ? matchValue_5 : (property_4.IsOptional ? (new FSharpType(/* Option */ 3, [matchValue_5])) : matchValue_5))];
4357
+ }, filter((property_3) => (property_3.Name !== tagName_1), tupledArg_2[1][1]))]);
4358
+ }, zip(deduplicateCaseNames(map((arg) => {
4359
+ const tupledArg_1 = arg[0];
4360
+ const literal_7 = tupledArg_1[0];
4361
+ const enumMemberName = tupledArg_1[1];
4362
+ if (enumMemberName == null) {
4363
+ return literalCaseInfo(literal_7);
4364
+ }
4365
+ else if (literal_7.tag === 0) {
4366
+ const name_3 = enumMemberName;
4367
+ return new FSharpUnionCaseNamed(singleton(new FSharpAttribute(/* CompiledName */ 13, [removeSurroundingQuotes(literal_7.fields[0])])), sanitizeTypeName(name_3));
4368
+ }
4369
+ else {
4370
+ const name_4 = enumMemberName;
4371
+ return new FSharpUnionCaseNamed(literalCaseInfo(literal_7).Attributes, sanitizeTypeName(name_4));
4372
+ }
4373
+ }, taggedCases)), taggedCases));
4374
+ const interfaceCases = choose((_arg_14) => {
4375
+ if (_arg_14.tag === 13) {
4376
+ return transformType(context, _arg_14);
4377
+ }
4378
+ else {
4379
+ return undefined;
4380
+ }
4381
+ }, otherCases_1);
4382
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* TypeScriptTaggedUnion */ 8, [removeSurroundingQuotes(tagName_1), 0])]), typeName, cases_6, false, empty(), empty(), (length(interfaceCases) === length(otherCases_1)) ? interfaceCases : empty())]);
4050
4383
  }
4051
4384
  }
4052
4385
 
@@ -4108,7 +4441,7 @@ function transformMappedTypeMembers(context, mappedType) {
4108
4441
  switch (matchValue.tag) {
4109
4442
  case 10: {
4110
4443
  switch (matchValue.fields[0].ObjectType.tag) {
4111
- case 30: {
4444
+ case 31: {
4112
4445
  if (matchValue.fields[0].ObjectType.fields[0].tag === 18) {
4113
4446
  matchResult = 0;
4114
4447
  glueTypes = matchValue.fields[0].ObjectType.fields[0].fields[0];
@@ -4219,7 +4552,7 @@ function aliasOf(scope, typ) {
4219
4552
  }
4220
4553
 
4221
4554
  function aliasInterfaceOf(scope, typeParameters, members, inheritance) {
4222
- return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AllowNullLiteral, FSharpAttribute.Interface]), scope.Name, empty(), scope.Declaration.Name, typeParameters, members, inheritance)]);
4555
+ return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AllowNullLiteral, FSharpAttribute.Interface]), scope.Name, scope.XmlDoc.XmlDoc, scope.Declaration.Name, typeParameters, members, inheritance)]);
4223
4556
  }
4224
4557
 
4225
4558
  function isSelfReferencingUnion(name, cases) {
@@ -4268,7 +4601,7 @@ function aliasOfUnion(scope, cases, unionType) {
4268
4601
  const isSelfReferencing = isSelfReferencingUnion(scope.Declaration.Name, cases_1);
4269
4602
  const erasedUnionOf = (others) => {
4270
4603
  const casesContext = TransformContext__PushScope_27AED5E3(context, "Cases");
4271
- const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(casesContext, `Case${index + 1}`), caseType), others), {
4604
+ const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(casesContext, `Case${index + 1}`), caseType), withoutAliasesOfSamePrimitive(context, others)), {
4272
4605
  Equals: equals,
4273
4606
  GetHashCode: (x) => (safeHash(x) | 0),
4274
4607
  });
@@ -4338,67 +4671,196 @@ function aliasOfUnion(scope, cases, unionType) {
4338
4671
  }
4339
4672
  }
4340
4673
 
4674
+ function tryAliasOfSelfReferencingArray(scope, glueType) {
4675
+ let cases_1;
4676
+ const elementCases = (glueType.tag === 14) ? ((glueType.fields[0].tag === 7) ? glueType.fields[0].fields[0].fields[0] : undefined) : ((glueType.tag === 31) ? ((glueType.fields[0].tag === 14) ? ((glueType.fields[0].fields[0].tag === 7) ? glueType.fields[0].fields[0].fields[0].fields[0] : undefined) : undefined) : ((glueType.tag === 13) ? ((glueType.fields[0].Name === "Array") ? (!isEmpty(glueType.fields[0].TypeArguments) ? ((head_1(glueType.fields[0].TypeArguments).tag === 7) ? (isEmpty(tail_1(glueType.fields[0].TypeArguments)) ? head_1(glueType.fields[0].TypeArguments).fields[0].fields[0] : undefined) : undefined) : undefined) : ((glueType.fields[0].Name === "ReadonlyArray") ? (!isEmpty(glueType.fields[0].TypeArguments) ? ((head_1(glueType.fields[0].TypeArguments).tag === 7) ? (isEmpty(tail_1(glueType.fields[0].TypeArguments)) ? head_1(glueType.fields[0].TypeArguments).fields[0].fields[0] : undefined) : undefined) : undefined) : undefined)) : undefined));
4677
+ let matchResult, cases_2;
4678
+ if (elementCases != null) {
4679
+ if ((cases_1 = elementCases, isEmpty(scope.TypeParameters.Value.TypeParameters) && isSelfReferencingUnion(scope.Declaration.Name, cases_1))) {
4680
+ matchResult = 0;
4681
+ cases_2 = elementCases;
4682
+ }
4683
+ else {
4684
+ matchResult = 1;
4685
+ }
4686
+ }
4687
+ else {
4688
+ matchResult = 1;
4689
+ }
4690
+ switch (matchResult) {
4691
+ case 0: {
4692
+ const context = scope.Context;
4693
+ const itemContext = TransformContext__PushScope_27AED5E3(context, "Item");
4694
+ const casesContext = TransformContext__PushScope_27AED5E3(itemContext, "Cases");
4695
+ TransformContext__ExposeType_Z1D58A540(itemContext, new FSharpType(/* Union */ 1, [erasedUnion("Item", empty(), List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(casesContext, `Case${index + 1}`), caseType), map(arrayAsInput, filter((arg) => !isNullish(arg), cases_2))), {
4696
+ Equals: equals,
4697
+ GetHashCode: (x) => (safeHash(x) | 0),
4698
+ }))]));
4699
+ const item = referenceToExposed(itemContext, "Item", empty());
4700
+ return aliasOf(scope, (glueType.tag === 14) ? (new FSharpType(/* ResizeArray */ 14, [item])) : ((TransformContext__ExposeReadonlyArray(context), new FSharpType(/* JSApi */ 19, [new FSharpJSApi(item)]))));
4701
+ }
4702
+ default:
4703
+ return undefined;
4704
+ }
4705
+ }
4706
+
4341
4707
  function aliasOfIndexedAccessType(scope, glueType) {
4708
+ let constraintInfo;
4342
4709
  const matchValue = glueType.IndexType;
4343
- let matchResult, interfaceInfo;
4710
+ const matchValue_1 = glueType.ObjectType;
4711
+ let matchResult, constraintInfo_1, indexed_1, interfaceInfo_3, name_1, valueName_1, fullName_2, interfaceInfo_4;
4344
4712
  if (matchValue.tag === 9) {
4345
4713
  if (matchValue.fields[0].tag === 1) {
4346
- matchResult = 0;
4347
- interfaceInfo = matchValue.fields[0].fields[0];
4714
+ switch (matchValue_1.tag) {
4715
+ case 28: {
4716
+ if (matchValue_1.fields[0].TypeParameter.Constraint != null) {
4717
+ if (matchValue_1.fields[0].TypeParameter.Constraint.tag === 9) {
4718
+ if (matchValue_1.fields[0].TypeParameter.Constraint.fields[0].tag === 1) {
4719
+ if (matchValue_1.fields[0].Type != null) {
4720
+ if (matchValue_1.fields[0].Type.tag === 16) {
4721
+ if ((constraintInfo = matchValue_1.fields[0].TypeParameter.Constraint.fields[0].fields[0], (matchValue_1.fields[0].TypeParameter.Name === matchValue_1.fields[0].Type.fields[0]) && (constraintInfo.FullName === matchValue.fields[0].fields[0].FullName))) {
4722
+ matchResult = 0;
4723
+ constraintInfo_1 = matchValue_1.fields[0].TypeParameter.Constraint.fields[0].fields[0];
4724
+ indexed_1 = matchValue.fields[0];
4725
+ interfaceInfo_3 = matchValue.fields[0].fields[0];
4726
+ name_1 = matchValue_1.fields[0].TypeParameter.Name;
4727
+ valueName_1 = matchValue_1.fields[0].Type.fields[0];
4728
+ }
4729
+ else {
4730
+ matchResult = 2;
4731
+ }
4732
+ }
4733
+ else {
4734
+ matchResult = 2;
4735
+ }
4736
+ }
4737
+ else {
4738
+ matchResult = 2;
4739
+ }
4740
+ }
4741
+ else {
4742
+ matchResult = 2;
4743
+ }
4744
+ }
4745
+ else {
4746
+ matchResult = 2;
4747
+ }
4748
+ }
4749
+ else {
4750
+ matchResult = 2;
4751
+ }
4752
+ break;
4753
+ }
4754
+ case 13: {
4755
+ if (matchValue_1.fields[0].FullName === matchValue.fields[0].fields[0].FullName) {
4756
+ matchResult = 1;
4757
+ fullName_2 = matchValue_1.fields[0].FullName;
4758
+ interfaceInfo_4 = matchValue.fields[0].fields[0];
4759
+ }
4760
+ else {
4761
+ matchResult = 2;
4762
+ }
4763
+ break;
4764
+ }
4765
+ case 1: {
4766
+ if (matchValue_1.fields[0].FullName === matchValue.fields[0].fields[0].FullName) {
4767
+ matchResult = 1;
4768
+ fullName_2 = matchValue_1.fields[0].FullName;
4769
+ interfaceInfo_4 = matchValue.fields[0].fields[0];
4770
+ }
4771
+ else {
4772
+ matchResult = 2;
4773
+ }
4774
+ break;
4775
+ }
4776
+ default:
4777
+ matchResult = 2;
4778
+ }
4348
4779
  }
4349
4780
  else {
4350
- matchResult = 1;
4781
+ matchResult = 2;
4351
4782
  }
4352
4783
  }
4353
4784
  else {
4354
- matchResult = 1;
4785
+ matchResult = 2;
4355
4786
  }
4356
4787
  switch (matchResult) {
4357
- case 0:
4358
- return aliasOf(scope, transformType(scope.Context, new GlueType(/* Union */ 7, [new GlueTypeUnion(List_distinct(collect((m) => {
4359
- let typ;
4788
+ case 0: {
4789
+ const matchValue_3 = TypeAliasDeclaration_transformKeyOf(scope.Context, scope.Declaration.Name, indexed_1);
4790
+ if (matchValue_3.tag === 10) {
4791
+ return aliasOf(scope, FSharpType.Object$);
4792
+ }
4793
+ else {
4794
+ return matchValue_3;
4795
+ }
4796
+ }
4797
+ case 1: {
4798
+ const _arg = List_distinct(collect((m) => {
4799
+ let typ_1;
4360
4800
  switch (m.tag) {
4361
4801
  case 1: {
4362
- typ = m.fields[0].Type;
4802
+ typ_1 = m.fields[0].Type;
4363
4803
  break;
4364
4804
  }
4365
4805
  case 2: {
4366
- typ = m.fields[0].Type;
4806
+ typ_1 = m.fields[0].Type;
4367
4807
  break;
4368
4808
  }
4369
4809
  case 3: {
4370
- typ = m.fields[0].ArgumentType;
4810
+ typ_1 = m.fields[0].ArgumentType;
4371
4811
  break;
4372
4812
  }
4373
4813
  case 4: {
4374
- typ = m.fields[0].Type;
4814
+ typ_1 = m.fields[0].Type;
4375
4815
  break;
4376
4816
  }
4377
4817
  case 7: {
4378
- typ = m.fields[0].Type;
4818
+ typ_1 = m.fields[0].Type;
4379
4819
  break;
4380
4820
  }
4381
4821
  case 6: {
4382
- typ = m.fields[0].Type;
4822
+ typ_1 = m.fields[0].Type;
4383
4823
  break;
4384
4824
  }
4385
4825
  case 5: {
4386
- typ = m.fields[0].Type;
4826
+ typ_1 = m.fields[0].Type;
4387
4827
  break;
4388
4828
  }
4389
4829
  default:
4390
- typ = m.fields[0].Type;
4830
+ typ_1 = m.fields[0].Type;
4391
4831
  }
4392
- if (typ.tag === 7) {
4393
- return typ.fields[0].fields[0];
4832
+ if (typ_1.tag === 7) {
4833
+ return typ_1.fields[0].fields[0];
4394
4834
  }
4395
4835
  else {
4396
- return singleton(typ);
4836
+ return singleton(typ_1);
4397
4837
  }
4398
- }, interfaceInfo.Members), {
4838
+ }, interfaceInfo_4.Members), {
4399
4839
  Equals: equals,
4400
4840
  GetHashCode: (x) => (safeHash(x) | 0),
4401
- }))])));
4841
+ });
4842
+ let matchResult_2, cases_1, cases_2;
4843
+ if (!isEmpty(_arg)) {
4844
+ if (!isEmpty(tail_1(_arg))) {
4845
+ matchResult_2 = 0;
4846
+ cases_1 = _arg;
4847
+ }
4848
+ else {
4849
+ matchResult_2 = 1;
4850
+ cases_2 = _arg;
4851
+ }
4852
+ }
4853
+ else {
4854
+ matchResult_2 = 1;
4855
+ cases_2 = _arg;
4856
+ }
4857
+ switch (matchResult_2) {
4858
+ case 0:
4859
+ return aliasOfUnion(scope, cases_1, new GlueType(/* Union */ 7, [new GlueTypeUnion(cases_1)]));
4860
+ default:
4861
+ return aliasOf(scope, transformType(scope.Context, new GlueType(/* Union */ 7, [new GlueTypeUnion(cases_2)])));
4862
+ }
4863
+ }
4402
4864
  default:
4403
4865
  return aliasOf(scope, FSharpType.Discard);
4404
4866
  }
@@ -4499,21 +4961,20 @@ function aliasOfFunctionType(scope, functionType) {
4499
4961
  const context = scope.Context;
4500
4962
  const ownDefaults = ownTypeParameterDefaults(functionType);
4501
4963
  const parameters = map((parameter) => GlueSubstitution_substituteParameter(ownDefaults, parameter), functionType.Parameters);
4502
- const returnType = GlueSubstitution_substitute(ownDefaults, functionType.Type);
4503
4964
  const declaredTypeParameters = scope.TypeParameters.Value.TypeParameters;
4504
- if (isLambdaSignature(parameters, empty(), declaredTypeParameters)) {
4505
- return aliasOf(scope, new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), parameters), transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), returnType))]));
4965
+ if (!exists((glueType) => !equals(replaceSelfReference(scope.Declaration.Name, glueType), glueType), cons(functionType.Type, map((_arg) => _arg.Type, parameters))) && isLambdaSignature(parameters, empty(), declaredTypeParameters)) {
4966
+ return aliasOf(scope, new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), parameters), transformOwnCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), ownDefaults, functionType.Type))]));
4506
4967
  }
4507
4968
  else {
4508
- return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(scope.XmlDoc.XmlDoc, scope.Name, declaredTypeParameters, requiredBeforeParamArray(map((parameter_2) => transformParameter(context, parameter_2), parameters)), transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), returnType))]);
4969
+ return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(scope.XmlDoc.XmlDoc, scope.Name, declaredTypeParameters, requiredBeforeParamArray(map((parameter_2) => transformParameter(context, parameter_2), parameters)), transformOwnCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), ownDefaults, functionType.Type))]);
4509
4970
  }
4510
4971
  }
4511
4972
 
4512
4973
  function aliasOfTypeLiteral(scope, typeLiteralInfo) {
4513
4974
  const context = scope.Context;
4514
4975
  const typeParameters = scope.TypeParameters.Value.TypeParameters;
4515
- const candidate = new GlueInterface(scope.Declaration.Documentation, scope.Declaration.FullName, scope.Declaration.Name, typeLiteralInfo.Members, scope.Declaration.TypeParameters, empty());
4516
- const creates = isCandidate(TransformContext__get_TypeMemory(context), candidate) ? paramObjectCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(scope.Name, typeParameters)]), typeLiteralInfo.Members) : empty();
4976
+ const candidate = new GlueInterface(scope.Declaration.Documentation, scope.Declaration.FullName, scope.Declaration.Name, typeLiteralInfo.Members, isEmpty(collect(memberTypeParameterNames, typeLiteralInfo.Members)) ? empty() : scope.Declaration.TypeParameters, empty());
4977
+ const creates = isCandidate(TransformContext__get_TypeMemory(context), candidate) ? paramObjectCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(scope.Name, typeParameters)]), typeLiteralInfo.Members) : dictionaryCreateMembers(context, new FSharpType(/* Mapped */ 7, [new FSharpMapped(scope.Name, typeParameters)]), typeLiteralInfo.Members);
4517
4978
  return aliasInterfaceOf(scope, typeParameters, append(TransformMembers_toFSharpMember(context, typeLiteralInfo.Members), creates), ofArray(toArray(TypeLiteral_tryFindIterableType(context, typeLiteralInfo.Members))));
4518
4979
  }
4519
4980
 
@@ -4565,317 +5026,273 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
4565
5026
  default:
4566
5027
  aliasType = replaceSelfReference(glueTypeAliasDeclaration.Name, glueType);
4567
5028
  }
4568
- let fsharpType;
4569
- let matchResult_1, cases_2, unionType, glueType_1, glueType_2, literalInfo, primitiveInfo, typeReference, glueType_3, utilityType, functionType, glueTypes, members_1, members_2, references, typeLiteralInfo, typeParameterInfo, mappedType, constructSignature, glueType_5, glueType_6;
4570
- switch (aliasType.tag) {
4571
- case 26: {
4572
- matchResult_1 = 5;
4573
- break;
4574
- }
4575
- case 24: {
4576
- matchResult_1 = 14;
4577
- break;
4578
- }
4579
- case 12:
4580
- case 31:
4581
- case 32:
4582
- case 33:
4583
- case 4:
4584
- case 1:
4585
- case 11:
4586
- case 5:
4587
- case 0:
4588
- case 6:
4589
- case 17:
4590
- case 2:
4591
- case 25:
4592
- case 19:
4593
- case 23: {
4594
- matchResult_1 = 20;
4595
- break;
4596
- }
4597
- case 9: {
4598
- matchResult_1 = 1;
4599
- glueType_1 = aliasType.fields[0];
4600
- break;
4601
- }
4602
- case 10: {
4603
- matchResult_1 = 2;
4604
- glueType_2 = aliasType.fields[0];
4605
- break;
4606
- }
4607
- case 8: {
4608
- matchResult_1 = 3;
4609
- literalInfo = aliasType.fields[0];
4610
- break;
4611
- }
4612
- case 3: {
4613
- matchResult_1 = 4;
4614
- primitiveInfo = aliasType.fields[0];
4615
- break;
4616
- }
4617
- case 13: {
4618
- matchResult_1 = 6;
4619
- typeReference = aliasType.fields[0];
4620
- break;
4621
- }
4622
- case 14: {
4623
- matchResult_1 = 7;
4624
- glueType_3 = aliasType.fields[0];
4625
- break;
4626
- }
4627
- case 27: {
4628
- matchResult_1 = 8;
4629
- utilityType = aliasType.fields[0];
4630
- break;
4631
- }
4632
- case 15: {
4633
- matchResult_1 = 9;
4634
- functionType = aliasType.fields[0];
4635
- break;
4636
- }
4637
- case 18: {
4638
- matchResult_1 = 10;
4639
- glueTypes = aliasType.fields[0];
4640
- break;
4641
- }
4642
- case 20: {
4643
- matchResult_1 = 11;
4644
- members_1 = aliasType.fields[0];
4645
- break;
4646
- }
4647
- case 21: {
4648
- matchResult_1 = 12;
4649
- members_2 = aliasType.fields[1];
4650
- references = aliasType.fields[0];
4651
- break;
4652
- }
4653
- case 22: {
4654
- matchResult_1 = 13;
4655
- typeLiteralInfo = aliasType.fields[0];
4656
- break;
4657
- }
4658
- case 16: {
4659
- matchResult_1 = 15;
4660
- typeParameterInfo = aliasType.fields[0];
4661
- break;
4662
- }
4663
- case 28: {
4664
- matchResult_1 = 16;
4665
- mappedType = aliasType.fields[0];
4666
- break;
4667
- }
4668
- case 29: {
4669
- matchResult_1 = 17;
4670
- constructSignature = aliasType.fields[0];
4671
- break;
4672
- }
4673
- case 30: {
4674
- if (aliasType.fields[0].tag === 14) {
4675
- matchResult_1 = 18;
4676
- glueType_5 = aliasType.fields[0];
4677
- }
4678
- else {
4679
- matchResult_1 = 19;
4680
- glueType_6 = aliasType.fields[0];
5029
+ let fsharpType_1;
5030
+ const matchValue_1 = tryAliasOfSelfReferencingArray(scope, glueTypeAliasDeclaration.Type);
5031
+ if (matchValue_1 == null) {
5032
+ const aliasType_1 = aliasType;
5033
+ let matchResult_1, cases_2, unionType, glueType_1, glueType_2, literalInfo, primitiveInfo, typeReference, glueType_3, utilityType, functionType, glueTypes, members_1, members_2, references, typeLiteralInfo, typeParameterInfo, mappedType, constructSignature, glueType_5, glueType_6;
5034
+ switch (aliasType_1.tag) {
5035
+ case 26: {
5036
+ matchResult_1 = 5;
5037
+ break;
4681
5038
  }
4682
- break;
4683
- }
4684
- default: {
4685
- matchResult_1 = 0;
4686
- cases_2 = aliasType.fields[0].fields[0];
4687
- unionType = aliasType;
4688
- }
4689
- }
4690
- switch (matchResult_1) {
4691
- case 0: {
4692
- fsharpType = aliasOfUnion(scope, cases_2, unionType);
4693
- break;
4694
- }
4695
- case 1: {
4696
- const matchValue_1 = TypeAliasDeclaration_transformKeyOf(context_1, glueTypeAliasDeclaration.Name, glueType_1);
4697
- fsharpType = ((matchValue_1.tag === 10) ? aliasOf(scope, FSharpType.Object$) : matchValue_1);
4698
- break;
4699
- }
4700
- case 2: {
4701
- fsharpType = aliasOfIndexedAccessType(scope, glueType_2);
4702
- break;
4703
- }
4704
- case 3: {
4705
- fsharpType = TypeAliasDeclaration_transformLiteral(scope.XmlDoc, typeAliasName, literalInfo);
4706
- break;
4707
- }
4708
- case 4: {
4709
- fsharpType = aliasOf(scope, new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]));
4710
- break;
4711
- }
4712
- case 5: {
4713
- fsharpType = aliasOf(scope, new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]));
4714
- break;
4715
- }
4716
- case 6: {
4717
- fsharpType = aliasOfTypeReference(scope, typeReference);
4718
- break;
4719
- }
4720
- case 7: {
4721
- fsharpType = aliasOf(scope, transformType(context_1, new GlueType(/* Array */ 14, [glueType_3])));
4722
- break;
4723
- }
4724
- case 8: {
4725
- fsharpType = aliasOfUtilityType(scope, utilityType);
4726
- break;
4727
- }
4728
- case 9: {
4729
- fsharpType = aliasOfFunctionType(scope, functionType);
4730
- break;
4731
- }
4732
- case 10: {
4733
- fsharpType = aliasOf(scope, transformTupleType(TransformContext__PushScope_27AED5E3(context_1, "Item"), glueTypes));
4734
- break;
4735
- }
4736
- case 11: {
4737
- fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, members_1), empty());
4738
- break;
4739
- }
4740
- case 12: {
4741
- const matchValue_2 = inheritableBases(context_1, references);
4742
- fsharpType = (isEmpty(matchValue_2) ? aliasOf(scope, FSharpType.Object$) : aliasInterface(TransformMembers_toFSharpMember(context_1, members_2), map((glueType_4) => transformType(context_1, glueType_4), matchValue_2)));
4743
- break;
4744
- }
4745
- case 13: {
4746
- fsharpType = aliasOfTypeLiteral(scope, typeLiteralInfo);
4747
- break;
4748
- }
4749
- case 14: {
4750
- fsharpType = aliasOf(scope, FSharpType.Object$);
4751
- break;
4752
- }
4753
- case 15: {
4754
- fsharpType = aliasOf(scope, new FSharpType(/* TypeParameter */ 13, [typeParameterInfo]));
4755
- break;
4756
- }
4757
- case 16: {
4758
- fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, mappedType)), empty());
4759
- break;
4760
- }
4761
- case 17: {
4762
- fsharpType = aliasOfConstructorType(scope, constructSignature);
4763
- break;
4764
- }
4765
- case 18: {
4766
- fsharpType = aliasOf(scope, transformReadOnlyModifier(context_1, glueType_5));
4767
- break;
4768
- }
4769
- case 19: {
4770
- fsharpType = aliasOf(scope, transformReadOnlyModifier(TransformContext__PushScope_27AED5E3(context_1, "Item"), glueType_6));
4771
- break;
4772
- }
4773
- default:
4774
- fsharpType = aliasOf(scope, FSharpType.Object$);
4775
- }
4776
- if (scope.TypeParameters.IsValueCreated) {
4777
- const typeParameters = scope.TypeParameters.Value.TypeParameters;
4778
- const defaultAliases = exposeSpecializedAlias(typeAliasName, empty(), empty(), reverse(typeParameters));
4779
- iterate((typ_8) => {
4780
- TransformContext__ExposeType_Z1D58A540(context_1, typ_8);
4781
- }, defaultAliases);
4782
- let option_1;
4783
- const typeParametersResult = scope.TypeParameters.Value;
4784
- option_1 = makeSealedTypeAlias(typeAliasName, aliasArities(typeParameters, defaultAliases), typeParametersResult);
4785
- if (option_1 != null) {
4786
- TransformContext__ExposeType_Z1D58A540(context_1, option_1);
4787
- }
4788
- }
4789
- return fsharpType;
4790
- }
4791
-
4792
- function ReExport_isExpressible(glueType_mut) {
4793
- ReExport_isExpressible:
4794
- while (true) {
4795
- const glueType = glueType_mut;
4796
- let matchResult, innerType;
4797
- switch (glueType.tag) {
4798
- case 13:
4799
- case 3:
4800
5039
  case 24: {
4801
- matchResult = 0;
5040
+ matchResult_1 = 14;
5041
+ break;
5042
+ }
5043
+ case 30: {
5044
+ matchResult_1 = 18;
5045
+ break;
5046
+ }
5047
+ case 12:
5048
+ case 32:
5049
+ case 33:
5050
+ case 34:
5051
+ case 4:
5052
+ case 1:
5053
+ case 11:
5054
+ case 5:
5055
+ case 0:
5056
+ case 6:
5057
+ case 17:
5058
+ case 2:
5059
+ case 25:
5060
+ case 19:
5061
+ case 23: {
5062
+ matchResult_1 = 21;
4802
5063
  break;
4803
5064
  }
4804
- case 7: {
4805
- matchResult = 2;
5065
+ case 9: {
5066
+ matchResult_1 = 1;
5067
+ glueType_1 = aliasType_1.fields[0];
4806
5068
  break;
4807
5069
  }
4808
- case 18: {
4809
- matchResult = 3;
5070
+ case 10: {
5071
+ matchResult_1 = 2;
5072
+ glueType_2 = aliasType_1.fields[0];
4810
5073
  break;
4811
5074
  }
4812
- case 30: {
4813
- matchResult = 1;
4814
- innerType = glueType.fields[0];
5075
+ case 8: {
5076
+ matchResult_1 = 3;
5077
+ literalInfo = aliasType_1.fields[0];
5078
+ break;
5079
+ }
5080
+ case 3: {
5081
+ matchResult_1 = 4;
5082
+ primitiveInfo = aliasType_1.fields[0];
5083
+ break;
5084
+ }
5085
+ case 13: {
5086
+ matchResult_1 = 6;
5087
+ typeReference = aliasType_1.fields[0];
4815
5088
  break;
4816
5089
  }
4817
5090
  case 14: {
4818
- matchResult = 1;
4819
- innerType = glueType.fields[0];
5091
+ matchResult_1 = 7;
5092
+ glueType_3 = aliasType_1.fields[0];
4820
5093
  break;
4821
5094
  }
4822
- case 23: {
4823
- matchResult = 1;
4824
- innerType = glueType.fields[0];
5095
+ case 27: {
5096
+ matchResult_1 = 8;
5097
+ utilityType = aliasType_1.fields[0];
4825
5098
  break;
4826
5099
  }
4827
- default:
4828
- matchResult = 4;
5100
+ case 15: {
5101
+ matchResult_1 = 9;
5102
+ functionType = aliasType_1.fields[0];
5103
+ break;
5104
+ }
5105
+ case 18: {
5106
+ matchResult_1 = 10;
5107
+ glueTypes = aliasType_1.fields[0];
5108
+ break;
5109
+ }
5110
+ case 20: {
5111
+ matchResult_1 = 11;
5112
+ members_1 = aliasType_1.fields[0];
5113
+ break;
5114
+ }
5115
+ case 21: {
5116
+ matchResult_1 = 12;
5117
+ members_2 = aliasType_1.fields[1];
5118
+ references = aliasType_1.fields[0];
5119
+ break;
5120
+ }
5121
+ case 22: {
5122
+ matchResult_1 = 13;
5123
+ typeLiteralInfo = aliasType_1.fields[0];
5124
+ break;
5125
+ }
5126
+ case 16: {
5127
+ matchResult_1 = 15;
5128
+ typeParameterInfo = aliasType_1.fields[0];
5129
+ break;
5130
+ }
5131
+ case 28: {
5132
+ matchResult_1 = 16;
5133
+ mappedType = aliasType_1.fields[0];
5134
+ break;
5135
+ }
5136
+ case 29: {
5137
+ matchResult_1 = 17;
5138
+ constructSignature = aliasType_1.fields[0];
5139
+ break;
5140
+ }
5141
+ case 31: {
5142
+ if (aliasType_1.fields[0].tag === 14) {
5143
+ matchResult_1 = 19;
5144
+ glueType_5 = aliasType_1.fields[0];
5145
+ }
5146
+ else {
5147
+ matchResult_1 = 20;
5148
+ glueType_6 = aliasType_1.fields[0];
5149
+ }
5150
+ break;
5151
+ }
5152
+ default: {
5153
+ matchResult_1 = 0;
5154
+ cases_2 = aliasType_1.fields[0].fields[0];
5155
+ unionType = aliasType_1;
5156
+ }
4829
5157
  }
4830
- switch (matchResult) {
4831
- case 0:
4832
- return true;
5158
+ switch (matchResult_1) {
5159
+ case 0: {
5160
+ fsharpType_1 = aliasOfUnion(scope, cases_2, unionType);
5161
+ break;
5162
+ }
4833
5163
  case 1: {
4834
- glueType_mut = innerType;
4835
- continue ReExport_isExpressible;
5164
+ const matchValue_3 = TypeAliasDeclaration_transformKeyOf(context_1, glueTypeAliasDeclaration.Name, glueType_1);
5165
+ fsharpType_1 = ((matchValue_3.tag === 10) ? aliasOf(scope, FSharpType.Object$) : matchValue_3);
5166
+ break;
5167
+ }
5168
+ case 2: {
5169
+ fsharpType_1 = aliasOfIndexedAccessType(scope, glueType_2);
5170
+ break;
5171
+ }
5172
+ case 3: {
5173
+ fsharpType_1 = TypeAliasDeclaration_transformLiteral(scope.XmlDoc, typeAliasName, literalInfo);
5174
+ break;
5175
+ }
5176
+ case 4: {
5177
+ fsharpType_1 = aliasOf(scope, new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]));
5178
+ break;
5179
+ }
5180
+ case 5: {
5181
+ fsharpType_1 = aliasOf(scope, new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]));
5182
+ break;
5183
+ }
5184
+ case 6: {
5185
+ fsharpType_1 = aliasOfTypeReference(scope, typeReference);
5186
+ break;
5187
+ }
5188
+ case 7: {
5189
+ fsharpType_1 = aliasOf(scope, transformType(context_1, new GlueType(/* Array */ 14, [glueType_3])));
5190
+ break;
5191
+ }
5192
+ case 8: {
5193
+ fsharpType_1 = aliasOfUtilityType(scope, utilityType);
5194
+ break;
5195
+ }
5196
+ case 9: {
5197
+ fsharpType_1 = aliasOfFunctionType(scope, functionType);
5198
+ break;
5199
+ }
5200
+ case 10: {
5201
+ fsharpType_1 = aliasOf(scope, transformTupleType(TransformContext__PushScope_27AED5E3(context_1, "Item"), glueTypes));
5202
+ break;
5203
+ }
5204
+ case 11: {
5205
+ fsharpType_1 = aliasInterface(TransformMembers_toFSharpMember(context_1, members_1), empty());
5206
+ break;
5207
+ }
5208
+ case 12: {
5209
+ const matchValue_4 = inheritableBases(context_1, references);
5210
+ fsharpType_1 = (isEmpty(matchValue_4) ? aliasOf(scope, FSharpType.Object$) : aliasInterface(TransformMembers_toFSharpMember(context_1, members_2), map((glueType_4) => transformType(context_1, glueType_4), matchValue_4)));
5211
+ break;
5212
+ }
5213
+ case 13: {
5214
+ fsharpType_1 = aliasOfTypeLiteral(scope, typeLiteralInfo);
5215
+ break;
5216
+ }
5217
+ case 14: {
5218
+ fsharpType_1 = aliasOf(scope, FSharpType.Object$);
5219
+ break;
5220
+ }
5221
+ case 15: {
5222
+ fsharpType_1 = aliasOf(scope, new FSharpType(/* TypeParameter */ 13, [typeParameterInfo]));
5223
+ break;
5224
+ }
5225
+ case 16: {
5226
+ fsharpType_1 = aliasInterface(TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, mappedType)), empty());
5227
+ break;
5228
+ }
5229
+ case 17: {
5230
+ fsharpType_1 = aliasOfConstructorType(scope, constructSignature);
5231
+ break;
5232
+ }
5233
+ case 18: {
5234
+ fsharpType_1 = aliasOf(scope, transformType(context_1, aliasType_1));
5235
+ break;
5236
+ }
5237
+ case 19: {
5238
+ fsharpType_1 = aliasOf(scope, transformReadOnlyModifier(context_1, glueType_5));
5239
+ break;
5240
+ }
5241
+ case 20: {
5242
+ fsharpType_1 = aliasOf(scope, transformReadOnlyModifier(TransformContext__PushScope_27AED5E3(context_1, "Item"), glueType_6));
5243
+ break;
4836
5244
  }
4837
- case 2:
4838
- return forAll(ReExport_isExpressible, glueType.fields[0].fields[0]);
4839
- case 3:
4840
- return forAll(ReExport_isExpressible, glueType.fields[0]);
4841
5245
  default:
4842
- return false;
5246
+ fsharpType_1 = aliasOf(scope, FSharpType.Object$);
5247
+ }
5248
+ }
5249
+ else {
5250
+ fsharpType_1 = matchValue_1;
5251
+ }
5252
+ if (scope.TypeParameters.IsValueCreated) {
5253
+ const typeParameters = scope.TypeParameters.Value.TypeParameters;
5254
+ const defaultAliases = exposeSpecializedAlias(typeAliasName, empty(), empty(), reverse(typeParameters));
5255
+ iterate((typ_9) => {
5256
+ TransformContext__ExposeType_Z1D58A540(context_1, typ_9);
5257
+ }, defaultAliases);
5258
+ let option_1;
5259
+ const typeParametersResult = scope.TypeParameters.Value;
5260
+ option_1 = makeSealedTypeAlias(typeAliasName, aliasArities(typeParameters, defaultAliases), typeParametersResult);
5261
+ if (option_1 != null) {
5262
+ TransformContext__ExposeType_Z1D58A540(context_1, option_1);
4843
5263
  }
4844
- break;
4845
5264
  }
5265
+ return fsharpType_1;
4846
5266
  }
4847
5267
 
4848
5268
  function ReExport_canForwardConstraints(typeParameters) {
4849
5269
  return forAll((typeParameter) => {
4850
5270
  const matchValue = typeParameter.Constraint;
4851
- let matchResult, constraintType;
5271
+ let matchResult;
4852
5272
  if (matchValue != null) {
4853
- switch (matchValue.tag) {
4854
- case 22:
4855
- case 20:
4856
- case 27:
4857
- case 28: {
4858
- matchResult = 0;
4859
- break;
4860
- }
4861
- default: {
4862
- matchResult = 1;
4863
- constraintType = matchValue;
4864
- }
5273
+ if (matchValue.tag === 9) {
5274
+ matchResult = 0;
5275
+ }
5276
+ else {
5277
+ matchResult = 1;
4865
5278
  }
4866
5279
  }
4867
5280
  else {
4868
- matchResult = 0;
5281
+ matchResult = 1;
4869
5282
  }
4870
5283
  switch (matchResult) {
4871
5284
  case 0:
4872
- return true;
5285
+ return false;
4873
5286
  default:
4874
- return ReExport_isExpressible(constraintType);
5287
+ return true;
4875
5288
  }
4876
5289
  }, typeParameters);
4877
5290
  }
4878
5291
 
5292
+ function ReExport_withoutConstraints(typeParameters) {
5293
+ return map((typeParameter) => (new GlueTypeParameter(typeParameter.Name, undefined, typeParameter.Default)), typeParameters);
5294
+ }
5295
+
4879
5296
  function transformReExport(context, reExport) {
4880
5297
  let declared;
4881
5298
  const matchValue = reExport.Declaration;
@@ -4913,7 +5330,7 @@ function transformReExport(context, reExport) {
4913
5330
  const typeParameters_1 = declared[1];
4914
5331
  const patternInput = sanitizeTypeNameAndPushScope(reExport.Name, context);
4915
5332
  const name = patternInput[0];
4916
- const typeParameters_2 = transformDeclarationTypeParameters(patternInput[1], typeParameters_1);
5333
+ const typeParameters_2 = transformDeclarationTypeParameters(patternInput[1], ReExport_withoutConstraints(typeParameters_1));
4917
5334
  return cons(new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(empty(), name, empty(), new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(sanitizeTypeName(originalName), originalName, reExport.ModulePath, map((_arg) => {
4918
5335
  if (_arg.tag === 0) {
4919
5336
  return _arg.fields[0];
@@ -4993,44 +5410,37 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
4993
5410
  }
4994
5411
 
4995
5412
  function transformClassDeclaration(context, classDeclaration) {
4996
- let list_6, f2_1, context_2, members_3, members_2;
5413
+ let list_7, f2_1, context_2, members_3, members_2;
4997
5414
  const patternInput = sanitizeTypeNameAndPushScope(classDeclaration.Name, context);
4998
5415
  const name = patternInput[0];
4999
5416
  const context_1 = patternInput[1];
5417
+ if (TransformContext__get_State(context_1).ClassConstructors.has(classDeclaration.FullName)) {
5418
+ exposeClassConstructor(context_1, classDeclaration);
5419
+ }
5000
5420
  let classDeclaration_1;
5001
- const patternInput_1 = withoutRedeclaredBases(TransformContext__get_TypeMemory(context_1), classDeclaration.Members, classDeclaration.HeritageClauses);
5002
- classDeclaration_1 = (new GlueClassDeclaration(classDeclaration.Documentation, classDeclaration.FullName, classDeclaration.Name, classDeclaration.Constructors, patternInput_1[1], classDeclaration.TypeParameters, patternInput_1[0], classDeclaration.IsExported));
5421
+ const thisType = new GlueThisType(classDeclaration.Name, classDeclaration.TypeParameters);
5422
+ const patternInput_1 = withoutRedeclaredBases(TransformContext__get_TypeMemory(context_1), thisType, classDeclaration.Members, classDeclaration.HeritageClauses);
5423
+ const members = patternInput_1[1];
5424
+ const heritageClauses = patternInput_1[0];
5425
+ classDeclaration_1 = (new GlueClassDeclaration(classDeclaration.Documentation, classDeclaration.FullName, classDeclaration.Name, classDeclaration.Constructors, append(members, thisMembersOfBases(TransformContext__get_TypeMemory(context_1), thisType, members, heritageClauses)), classDeclaration.TypeParameters, heritageClauses, classDeclaration.IsExported));
5003
5426
  const typeParametersResult = transformDeclarationTypeParameters(context_1, classDeclaration_1.TypeParameters);
5004
- const patternInput_2 = partition((heritageClause_1) => {
5005
- if (heritageClause_1.tag === 13) {
5006
- const typeReference = heritageClause_1.fields[0];
5007
- if (typeReference.IsStandardLibrary) {
5008
- return typeReference.Name === "Error";
5009
- }
5010
- else {
5011
- return false;
5012
- }
5013
- }
5014
- else {
5015
- return false;
5016
- }
5017
- }, filter((arg) => !isSelfHeritage(classDeclaration_1.FullName, arg), classDeclaration_1.HeritageClauses));
5427
+ const patternInput_2 = partition(isErrorHeritage, filter((arg) => !isSelfHeritage(classDeclaration_1.FullName, arg), classDeclaration_1.HeritageClauses));
5018
5428
  const otherInheritance = patternInput_2[1];
5019
5429
  const errorInheritance = patternInput_2[0];
5020
5430
  const isErrorDerived = (visited, heritageClause_2) => {
5021
5431
  if (heritageClause_2.tag === 13) {
5022
- const typeReference_1 = heritageClause_2.fields[0];
5023
- if (typeReference_1.IsStandardLibrary && (typeReference_1.Name === "Error")) {
5432
+ const typeReference = heritageClause_2.fields[0];
5433
+ if (isErrorHeritage(heritageClause_2)) {
5024
5434
  return true;
5025
5435
  }
5026
- else if (!contains(typeReference_1.Name, visited, {
5436
+ else if (!contains(typeReference.Name, visited, {
5027
5437
  Equals: (x, y) => (x === y),
5028
5438
  GetHashCode: (x) => (stringHash(x) | 0),
5029
5439
  })) {
5030
5440
  return exists((_arg) => {
5031
5441
  let matchResult, info_1;
5032
5442
  if (_arg.tag === 12) {
5033
- if (_arg.fields[0].Name === typeReference_1.Name) {
5443
+ if (_arg.fields[0].Name === typeReference.Name) {
5034
5444
  matchResult = 0;
5035
5445
  info_1 = _arg.fields[0];
5036
5446
  }
@@ -5043,7 +5453,7 @@ function transformClassDeclaration(context, classDeclaration) {
5043
5453
  }
5044
5454
  switch (matchResult) {
5045
5455
  case 0:
5046
- return exists(curry2(isErrorDerived)(cons(typeReference_1.Name, visited)), info_1.HeritageClauses);
5456
+ return exists(curry2(isErrorDerived)(cons(typeReference.Name, visited)), info_1.HeritageClauses);
5047
5457
  default:
5048
5458
  return false;
5049
5459
  }
@@ -5058,14 +5468,14 @@ function transformClassDeclaration(context, classDeclaration) {
5058
5468
  }
5059
5469
  };
5060
5470
  const hasErrorInheritance = !isEmpty(errorInheritance) ? true : exists(curry2(isErrorDerived)(empty()), otherInheritance);
5061
- const inheritance = List_distinct(filter(isInheritableType, (list_6 = filter((_arg_1) => {
5471
+ const inheritance = List_distinct(filter(isInheritableType, (list_7 = filter((_arg_1) => {
5062
5472
  if (_arg_1.tag === 0) {
5063
5473
  return false;
5064
5474
  }
5065
5475
  else {
5066
5476
  return !isArrayHeritage(_arg_1);
5067
5477
  }
5068
- }, toList(delay(() => append_1(!isEmpty(errorInheritance) ? singleton_1(new GlueType(/* TypeReference */ 13, [new GlueTypeReference("Exception", "System.Exception", empty(), empty(), true)])) : empty_1(), delay(() => otherInheritance))))), map((f2_1 = ((context_2 = TransformContext__PushScope_27AED5E3(context_1, "Extends"), (glueType) => transformType(context_2, glueType))), (arg_1) => f2_1(TransformContext__ExposeTypeAlias_1CE4A880(context_1, arg_1))), list_6))), {
5478
+ }, toList(delay(() => append_1(!isEmpty(errorInheritance) ? singleton_1(new GlueType(/* TypeReference */ 13, [new GlueTypeReference("Exception", "System.Exception", empty(), empty(), true)])) : empty_1(), delay(() => (hasErrorInheritance ? filter(curry2(isErrorDerived)(empty()), otherInheritance) : otherInheritance)))))), map((f2_1 = ((context_2 = TransformContext__PushScope_27AED5E3(context_1, "Extends"), (glueType) => transformType(context_2, glueType))), (arg_1) => f2_1(TransformContext__ExposeTypeAlias_1CE4A880(context_1, arg_1))), list_7))), {
5069
5479
  Equals: equals,
5070
5480
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
5071
5481
  });
@@ -5111,6 +5521,7 @@ function transformToFsharp(context, glueTypes) {
5111
5521
  let matchResult, interfaceInfo_1, interfaceInfo_2, enumInfo, typeAliasInfo, moduleInfo, fileModule, reExport, classInfo, exportedType;
5112
5522
  switch (_arg_1.tag) {
5113
5523
  case 29:
5524
+ case 30:
5114
5525
  case 28:
5115
5526
  case 15:
5116
5527
  case 16:
@@ -5132,8 +5543,8 @@ function transformToFsharp(context, glueTypes) {
5132
5543
  case 19:
5133
5544
  case 26:
5134
5545
  case 27:
5135
- case 30:
5136
- case 33:
5546
+ case 31:
5547
+ case 34:
5137
5548
  case 21:
5138
5549
  case 17: {
5139
5550
  matchResult = 9;
@@ -5154,12 +5565,12 @@ function transformToFsharp(context, glueTypes) {
5154
5565
  moduleInfo = _arg_1.fields[0];
5155
5566
  break;
5156
5567
  }
5157
- case 31: {
5568
+ case 32: {
5158
5569
  matchResult = 5;
5159
5570
  fileModule = _arg_1.fields[0];
5160
5571
  break;
5161
5572
  }
5162
- case 32: {
5573
+ case 33: {
5163
5574
  matchResult = 6;
5164
5575
  reExport = _arg_1.fields[0];
5165
5576
  break;
@@ -5195,7 +5606,7 @@ function transformToFsharp(context, glueTypes) {
5195
5606
  const matchValue = tryTransformCallableInterface(context, interfaceInfo_2);
5196
5607
  if (matchValue == null) {
5197
5608
  const fsharpInterface_1 = transformInterface(context, interfaceInfo_2);
5198
- return cons(new FSharpType(/* Interface */ 5, [fsharpInterface_1]), keysModuleOf(context, interfaceInfo_2, fsharpInterface_1));
5609
+ return cons(new FSharpType(/* Interface */ 5, [new FSharpInterface(fsharpInterface_1.Attributes, fsharpInterface_1.Name, fsharpInterface_1.XmlDoc, fsharpInterface_1.OriginalName, fsharpInterface_1.TypeParameters, append(fsharpInterface_1.Members, isEmpty(interfaceInfo_2.HeritageClauses) ? dictionaryCreateMembers(TransformContext__PushScope_27AED5E3(context, fsharpInterface_1.Name), new FSharpType(/* Mapped */ 7, [new FSharpMapped(fsharpInterface_1.Name, fsharpInterface_1.TypeParameters)]), interfaceInfo_2.Members) : empty()), fsharpInterface_1.Inheritance)]), keysModuleOf(context, interfaceInfo_2, fsharpInterface_1));
5199
5610
  }
5200
5611
  else {
5201
5612
  return singleton(matchValue);
@@ -5279,20 +5690,20 @@ function transformToFsharp(context, glueTypes) {
5279
5690
 
5280
5691
  function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource, isTopLevel, glueAst) {
5281
5692
  let exportEqualsNames, typeName, declaredNames;
5282
- const glueAst_2 = map((glueType_3) => {
5693
+ const glueAst_2 = map((glueType_5) => {
5283
5694
  let matchResult, info_5, name_3, info_6, name_4;
5284
- if (glueType_3.tag === 32) {
5285
- switch (glueType_3.fields[0].Declaration.tag) {
5695
+ if (glueType_5.tag === 33) {
5696
+ switch (glueType_5.fields[0].Declaration.tag) {
5286
5697
  case 6: {
5287
5698
  matchResult = 0;
5288
- info_5 = glueType_3.fields[0].Declaration.fields[0];
5289
- name_3 = glueType_3.fields[0].Name;
5699
+ info_5 = glueType_5.fields[0].Declaration.fields[0];
5700
+ name_3 = glueType_5.fields[0].Name;
5290
5701
  break;
5291
5702
  }
5292
5703
  case 2: {
5293
5704
  matchResult = 1;
5294
- info_6 = glueType_3.fields[0].Declaration.fields[0];
5295
- name_4 = glueType_3.fields[0].Name;
5705
+ info_6 = glueType_5.fields[0].Declaration.fields[0];
5706
+ name_4 = glueType_5.fields[0].Name;
5296
5707
  break;
5297
5708
  }
5298
5709
  default:
@@ -5308,23 +5719,45 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5308
5719
  case 1:
5309
5720
  return new GlueType(/* Variable */ 2, [new GlueVariable(info_6.Documentation, name_4, info_6.Type)]);
5310
5721
  default:
5311
- return glueType_3;
5722
+ return glueType_5;
5312
5723
  }
5313
- }, (exportEqualsNames = ofSeq_1(choose((_arg) => {
5314
- let matchResult_1, name;
5315
- if (_arg.tag === 25) {
5316
- if (_arg.fields[0].tag === 2) {
5724
+ }, collect((glueType_3) => {
5725
+ let matchResult_1, reExport, glueType_4;
5726
+ if (glueType_3.tag === 25) {
5727
+ if (glueType_3.fields[0].tag === 33) {
5317
5728
  matchResult_1 = 0;
5318
- name = _arg.fields[0].fields[0].Name;
5729
+ reExport = glueType_3.fields[0].fields[0];
5319
5730
  }
5320
5731
  else {
5321
5732
  matchResult_1 = 1;
5733
+ glueType_4 = glueType_3;
5322
5734
  }
5323
5735
  }
5324
5736
  else {
5325
5737
  matchResult_1 = 1;
5738
+ glueType_4 = glueType_3;
5326
5739
  }
5327
5740
  switch (matchResult_1) {
5741
+ case 0:
5742
+ return ofArray([new GlueType(/* ReExport */ 33, [reExport]), new GlueType(/* ExportDefault */ 25, [new GlueType(/* Variable */ 2, [new GlueVariable(empty(), reExport.Name, new GlueType(/* Primitive */ 3, [GluePrimitive.Any]))])])]);
5743
+ default:
5744
+ return singleton(glueType_4);
5745
+ }
5746
+ }, (exportEqualsNames = ofSeq_1(choose((_arg) => {
5747
+ let matchResult_2, name;
5748
+ if (_arg.tag === 25) {
5749
+ if (_arg.fields[0].tag === 2) {
5750
+ matchResult_2 = 0;
5751
+ name = _arg.fields[0].fields[0].Name;
5752
+ }
5753
+ else {
5754
+ matchResult_2 = 1;
5755
+ }
5756
+ }
5757
+ else {
5758
+ matchResult_2 = 1;
5759
+ }
5760
+ switch (matchResult_2) {
5328
5761
  case 0:
5329
5762
  return replace(name, "export=", "");
5330
5763
  default:
@@ -5344,30 +5777,30 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5344
5777
  return undefined;
5345
5778
  }
5346
5779
  }), (declaredNames = ofSeq_1(choose((_arg_1) => {
5347
- let matchResult_2, info_3, info_4, glueType_1;
5780
+ let matchResult_3, info_3, info_4, glueType_1;
5348
5781
  switch (_arg_1.tag) {
5349
5782
  case 12: {
5350
- matchResult_2 = 0;
5783
+ matchResult_3 = 0;
5351
5784
  info_3 = _arg_1.fields[0];
5352
5785
  break;
5353
5786
  }
5354
5787
  case 25: {
5355
5788
  if (_arg_1.fields[0].tag === 12) {
5356
- matchResult_2 = 1;
5789
+ matchResult_3 = 1;
5357
5790
  info_4 = _arg_1.fields[0].fields[0];
5358
5791
  }
5359
5792
  else {
5360
- matchResult_2 = 2;
5793
+ matchResult_3 = 2;
5361
5794
  glueType_1 = _arg_1;
5362
5795
  }
5363
5796
  break;
5364
5797
  }
5365
5798
  default: {
5366
- matchResult_2 = 2;
5799
+ matchResult_3 = 2;
5367
5800
  glueType_1 = _arg_1;
5368
5801
  }
5369
5802
  }
5370
- switch (matchResult_2) {
5803
+ switch (matchResult_3) {
5371
5804
  case 0:
5372
5805
  return info_3.Name;
5373
5806
  case 1:
@@ -5378,40 +5811,40 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5378
5811
  }, glueAst), {
5379
5812
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
5380
5813
  }), append(glueAst, collect((_arg_2) => {
5381
- let matchResult_3, moduleInfo_1;
5814
+ let matchResult_4, moduleInfo_1;
5382
5815
  if (_arg_2.tag === 11) {
5383
5816
  if (FSharpSet__Contains(exportEqualsNames, _arg_2.fields[0].Name)) {
5384
- matchResult_3 = 0;
5817
+ matchResult_4 = 0;
5385
5818
  moduleInfo_1 = _arg_2.fields[0];
5386
5819
  }
5387
5820
  else {
5388
- matchResult_3 = 1;
5821
+ matchResult_4 = 1;
5389
5822
  }
5390
5823
  }
5391
5824
  else {
5392
- matchResult_3 = 1;
5825
+ matchResult_4 = 1;
5393
5826
  }
5394
- switch (matchResult_3) {
5827
+ switch (matchResult_4) {
5395
5828
  case 0: {
5396
5829
  const modulePath = singleton(sanitizeTypeName(removeSurroundingQuotes(moduleInfo_1.Name) + (moduleInfo_1.IsTopLevel ? "_" : "")));
5397
5830
  return choose((glueType_2) => {
5398
5831
  const matchValue = typeName(glueType_2);
5399
- let matchResult_4, name_2;
5832
+ let matchResult_5, name_2;
5400
5833
  if (matchValue != null) {
5401
5834
  if (!FSharpSet__Contains(declaredNames, matchValue)) {
5402
- matchResult_4 = 0;
5835
+ matchResult_5 = 0;
5403
5836
  name_2 = matchValue;
5404
5837
  }
5405
5838
  else {
5406
- matchResult_4 = 1;
5839
+ matchResult_5 = 1;
5407
5840
  }
5408
5841
  }
5409
5842
  else {
5410
- matchResult_4 = 1;
5843
+ matchResult_5 = 1;
5411
5844
  }
5412
- switch (matchResult_4) {
5845
+ switch (matchResult_5) {
5413
5846
  case 0:
5414
- return new GlueType(/* ReExport */ 32, [new GlueReExport(name_2, glueType_2, modulePath)]);
5847
+ return new GlueType(/* ReExport */ 33, [new GlueReExport(name_2, glueType_2, modulePath)]);
5415
5848
  default:
5416
5849
  return undefined;
5417
5850
  }
@@ -5420,41 +5853,41 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5420
5853
  default:
5421
5854
  return empty();
5422
5855
  }
5423
- }, glueAst))))));
5424
- const reExportedClasses = choose((glueType_4) => {
5425
- let matchResult_5, info_8, name_6;
5426
- if (glueType_4.tag === 32) {
5427
- if (glueType_4.fields[0].Declaration.tag === 12) {
5428
- if (ReExport_canForwardConstraints(glueType_4.fields[0].Declaration.fields[0].TypeParameters)) {
5429
- matchResult_5 = 0;
5430
- info_8 = glueType_4.fields[0].Declaration.fields[0];
5431
- name_6 = glueType_4.fields[0].Name;
5856
+ }, glueAst)))))));
5857
+ const reExportedClasses = choose((glueType_6) => {
5858
+ let matchResult_6, info_8, name_6;
5859
+ if (glueType_6.tag === 33) {
5860
+ if (glueType_6.fields[0].Declaration.tag === 12) {
5861
+ if (ReExport_canForwardConstraints(glueType_6.fields[0].Declaration.fields[0].TypeParameters)) {
5862
+ matchResult_6 = 0;
5863
+ info_8 = glueType_6.fields[0].Declaration.fields[0];
5864
+ name_6 = glueType_6.fields[0].Name;
5432
5865
  }
5433
5866
  else {
5434
- matchResult_5 = 1;
5867
+ matchResult_6 = 1;
5435
5868
  }
5436
5869
  }
5437
5870
  else {
5438
- matchResult_5 = 1;
5871
+ matchResult_6 = 1;
5439
5872
  }
5440
5873
  }
5441
5874
  else {
5442
- matchResult_5 = 1;
5875
+ matchResult_6 = 1;
5443
5876
  }
5444
- switch (matchResult_5) {
5877
+ switch (matchResult_6) {
5445
5878
  case 0:
5446
5879
  return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(info_8.Documentation, info_8.FullName, name_6, info_8.Constructors, info_8.Members, info_8.TypeParameters, info_8.HeritageClauses, info_8.IsExported)]);
5447
5880
  default:
5448
5881
  return undefined;
5449
5882
  }
5450
5883
  }, glueAst_2);
5451
- const patternInput = partition((glueType_5) => {
5452
- switch (glueType_5.tag) {
5884
+ const patternInput = partition((glueType_7) => {
5885
+ switch (glueType_7.tag) {
5453
5886
  case 2:
5454
5887
  case 6:
5455
5888
  return true;
5456
5889
  case 25: {
5457
- const exportedType = glueType_5.fields[0];
5890
+ const exportedType = glueType_7.fields[0];
5458
5891
  switch (exportedType.tag) {
5459
5892
  case 2:
5460
5893
  case 6:
@@ -5474,28 +5907,28 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5474
5907
  return false;
5475
5908
  }
5476
5909
  else {
5477
- return exists((glueType_6) => {
5478
- switch (glueType_6.tag) {
5910
+ return exists((glueType_8) => {
5911
+ switch (glueType_8.tag) {
5479
5912
  case 12:
5480
5913
  case 2:
5481
5914
  case 6:
5482
5915
  return true;
5483
5916
  case 11:
5484
- return applyModuleDeclaration(glueType_6.fields[0]);
5917
+ return applyModuleDeclaration(glueType_8.fields[0]);
5485
5918
  default:
5486
5919
  return false;
5487
5920
  }
5488
5921
  }, info_9.Types);
5489
5922
  }
5490
5923
  };
5491
- classes = filter((glueType_7) => {
5492
- switch (glueType_7.tag) {
5924
+ classes = filter((glueType_9) => {
5925
+ switch (glueType_9.tag) {
5493
5926
  case 12:
5494
5927
  return true;
5495
5928
  case 2:
5496
5929
  return true;
5497
5930
  case 11: {
5498
- const info_11 = glueType_7.fields[0];
5931
+ const info_11 = glueType_9.fields[0];
5499
5932
  if (!info_11.IsGlobal && info_11.IsExported) {
5500
5933
  return applyModuleDeclaration(info_11);
5501
5934
  }
@@ -5504,7 +5937,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5504
5937
  }
5505
5938
  }
5506
5939
  case 25:
5507
- if (glueType_7.fields[0].tag === 12) {
5940
+ if (glueType_9.fields[0].tag === 12) {
5508
5941
  return true;
5509
5942
  }
5510
5943
  else {
@@ -5518,27 +5951,27 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5518
5951
  const rootTransformContext = TransformContext_$ctor_Z1635F75A(reporter, "", typeMemory, state, typeLiteralsMemory, importSource);
5519
5952
  let typeTestAttributes;
5520
5953
  const classDeclarations = choose((_arg_3) => {
5521
- let matchResult_6, info_12;
5954
+ let matchResult_7, info_12;
5522
5955
  switch (_arg_3.tag) {
5523
5956
  case 12: {
5524
- matchResult_6 = 0;
5957
+ matchResult_7 = 0;
5525
5958
  info_12 = _arg_3.fields[0];
5526
5959
  break;
5527
5960
  }
5528
5961
  case 25: {
5529
5962
  if (_arg_3.fields[0].tag === 12) {
5530
- matchResult_6 = 0;
5963
+ matchResult_7 = 0;
5531
5964
  info_12 = _arg_3.fields[0].fields[0];
5532
5965
  }
5533
5966
  else {
5534
- matchResult_6 = 1;
5967
+ matchResult_7 = 1;
5535
5968
  }
5536
5969
  break;
5537
5970
  }
5538
5971
  default:
5539
- matchResult_6 = 1;
5972
+ matchResult_7 = 1;
5540
5973
  }
5541
- switch (matchResult_6) {
5974
+ switch (matchResult_7) {
5542
5975
  case 0:
5543
5976
  return info_12;
5544
5977
  default:
@@ -5546,32 +5979,32 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5546
5979
  }
5547
5980
  }, glueAst_2);
5548
5981
  const defaultExported = ofSeq_1(choose((_arg_4) => {
5549
- let matchResult_7, info_14, name_8;
5982
+ let matchResult_8, info_14, name_8;
5550
5983
  if (_arg_4.tag === 25) {
5551
5984
  switch (_arg_4.fields[0].tag) {
5552
5985
  case 12: {
5553
- matchResult_7 = 0;
5986
+ matchResult_8 = 0;
5554
5987
  info_14 = _arg_4.fields[0].fields[0];
5555
5988
  break;
5556
5989
  }
5557
5990
  case 2: {
5558
5991
  if (exists((info_13) => (info_13.Name === _arg_4.fields[0].fields[0].Name), classDeclarations)) {
5559
- matchResult_7 = 1;
5992
+ matchResult_8 = 1;
5560
5993
  name_8 = _arg_4.fields[0].fields[0].Name;
5561
5994
  }
5562
5995
  else {
5563
- matchResult_7 = 2;
5996
+ matchResult_8 = 2;
5564
5997
  }
5565
5998
  break;
5566
5999
  }
5567
6000
  default:
5568
- matchResult_7 = 2;
6001
+ matchResult_8 = 2;
5569
6002
  }
5570
6003
  }
5571
6004
  else {
5572
- matchResult_7 = 2;
6005
+ matchResult_8 = 2;
5573
6006
  }
5574
- switch (matchResult_7) {
6007
+ switch (matchResult_8) {
5575
6008
  case 0:
5576
6009
  return info_14.Name;
5577
6010
  case 1:
@@ -5593,11 +6026,11 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5593
6026
  Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
5594
6027
  });
5595
6028
  const constructorVariables = ofSeq_1(choose((_arg_6) => {
5596
- let matchResult_8, name_10, members_1, name_11;
6029
+ let matchResult_9, name_10, members_1, name_11;
5597
6030
  if (_arg_6.tag === 2) {
5598
6031
  switch (_arg_6.fields[0].Type.tag) {
5599
6032
  case 29: {
5600
- matchResult_8 = 0;
6033
+ matchResult_9 = 0;
5601
6034
  name_10 = _arg_6.fields[0].Name;
5602
6035
  break;
5603
6036
  }
@@ -5610,23 +6043,23 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5610
6043
  return false;
5611
6044
  }
5612
6045
  }, _arg_6.fields[0].Type.fields[0].Members)) {
5613
- matchResult_8 = 1;
6046
+ matchResult_9 = 1;
5614
6047
  members_1 = _arg_6.fields[0].Type.fields[0].Members;
5615
6048
  name_11 = _arg_6.fields[0].Name;
5616
6049
  }
5617
6050
  else {
5618
- matchResult_8 = 2;
6051
+ matchResult_9 = 2;
5619
6052
  }
5620
6053
  break;
5621
6054
  }
5622
6055
  default:
5623
- matchResult_8 = 2;
6056
+ matchResult_9 = 2;
5624
6057
  }
5625
6058
  }
5626
6059
  else {
5627
- matchResult_8 = 2;
6060
+ matchResult_9 = 2;
5628
6061
  }
5629
- switch (matchResult_8) {
6062
+ switch (matchResult_9) {
5630
6063
  case 0:
5631
6064
  return name_10;
5632
6065
  case 1:
@@ -5639,7 +6072,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5639
6072
  });
5640
6073
  typeTestAttributes = ((name_12) => (!isTopLevel ? empty() : (FSharpSet__Contains(defaultExported, name_12) ? importDefaultAttribute(name_12, importSource) : ((FSharpSet__Contains(classes_1, name_12) ? true : FSharpSet__Contains(constructorVariables, name_12)) ? importAttribute(name_12, importSource) : empty()))));
5641
6074
  const rest_1 = map((_arg_9) => {
5642
- let matchResult_9, info_17, fsharpType;
6075
+ let matchResult_10, info_17, fsharpType;
5643
6076
  if (_arg_9.tag === 5) {
5644
6077
  if (!exists((_arg_8) => {
5645
6078
  switch (_arg_8.tag) {
@@ -5652,19 +6085,19 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5652
6085
  return false;
5653
6086
  }
5654
6087
  }, _arg_9.fields[0].Attributes)) {
5655
- matchResult_9 = 0;
6088
+ matchResult_10 = 0;
5656
6089
  info_17 = _arg_9.fields[0];
5657
6090
  }
5658
6091
  else {
5659
- matchResult_9 = 1;
6092
+ matchResult_10 = 1;
5660
6093
  fsharpType = _arg_9;
5661
6094
  }
5662
6095
  }
5663
6096
  else {
5664
- matchResult_9 = 1;
6097
+ matchResult_10 = 1;
5665
6098
  fsharpType = _arg_9;
5666
6099
  }
5667
- switch (matchResult_9) {
6100
+ switch (matchResult_10) {
5668
6101
  case 0: {
5669
6102
  const matchValue_1 = typeTestAttributes(info_17.OriginalName);
5670
6103
  if (isEmpty(matchValue_1)) {
@@ -5684,21 +6117,21 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5684
6117
  }
5685
6118
  else {
5686
6119
  const matchValue_2 = transformExports(new Transforms(transformType, transformParameter, transformTypeParameters, TransformMembers_withDefaultedTypeParameterOverloadsOfFunction, TransformMembers_withDictionaryParameterOverloadsOfFunction), rootTransformContext, isTopLevel, exports_1);
5687
- let matchResult_10, exportsType;
6120
+ let matchResult_11, exportsType;
5688
6121
  if (matchValue_2.tag === 5) {
5689
6122
  if (isEmpty(matchValue_2.fields[0].Members)) {
5690
- matchResult_10 = 0;
6123
+ matchResult_11 = 0;
5691
6124
  }
5692
6125
  else {
5693
- matchResult_10 = 1;
6126
+ matchResult_11 = 1;
5694
6127
  exportsType = matchValue_2;
5695
6128
  }
5696
6129
  }
5697
6130
  else {
5698
- matchResult_10 = 1;
6131
+ matchResult_11 = 1;
5699
6132
  exportsType = matchValue_2;
5700
6133
  }
5701
- switch (matchResult_10) {
6134
+ switch (matchResult_11) {
5702
6135
  case 0: {
5703
6136
  exportsType_1 = undefined;
5704
6137
  break;