@glutinum/cli 1.0.0-beta.12 → 1.0.0-beta.13

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.
@@ -136,7 +136,7 @@ function eraseType(bound, typ) {
136
136
  default:
137
137
  return _arg_1;
138
138
  }
139
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
139
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants, unionInfo.Conversions)]);
140
140
  }
141
141
  case 10:
142
142
  return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), erase(functionType.ReturnType))]);
@@ -145,7 +145,7 @@ export function FSharpUnionConstant_$reflection() {
145
145
  }
146
146
 
147
147
  export class FSharpUnion extends Record {
148
- constructor(Attributes, Name, Cases, IsOptional, TypeParameters, Constants) {
148
+ constructor(Attributes, Name, Cases, IsOptional, TypeParameters, Constants, Conversions) {
149
149
  super();
150
150
  this.Attributes = Attributes;
151
151
  this.Name = Name;
@@ -153,11 +153,12 @@ export class FSharpUnion extends Record {
153
153
  this.IsOptional = IsOptional;
154
154
  this.TypeParameters = TypeParameters;
155
155
  this.Constants = Constants;
156
+ this.Conversions = Conversions;
156
157
  }
157
158
  }
158
159
 
159
160
  export function FSharpUnion_$reflection() {
160
- return record_type("Glutinum.Converter.FSharpAST.FSharpUnion", [], FSharpUnion, () => [["Attributes", list_type(FSharpAttribute_$reflection())], ["Name", string_type], ["Cases", list_type(FSharpUnionCase_$reflection())], ["IsOptional", bool_type], ["TypeParameters", list_type(FSharpTypeParameter_$reflection())], ["Constants", list_type(FSharpUnionConstant_$reflection())]]);
161
+ return record_type("Glutinum.Converter.FSharpAST.FSharpUnion", [], FSharpUnion, () => [["Attributes", list_type(FSharpAttribute_$reflection())], ["Name", string_type], ["Cases", list_type(FSharpUnionCase_$reflection())], ["IsOptional", bool_type], ["TypeParameters", list_type(FSharpTypeParameter_$reflection())], ["Constants", list_type(FSharpUnionConstant_$reflection())], ["Conversions", list_type(FSharpType_$reflection())]]);
161
162
  }
162
163
 
163
164
  export class FSharpModule extends Record {
@@ -661,7 +662,7 @@ export function FSharpTypeModule_mapChildren(f, typ) {
661
662
  default:
662
663
  return _arg;
663
664
  }
664
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
665
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants, unionInfo.Conversions)]);
665
666
  }
666
667
  case 16: {
667
668
  const functionType = typ.fields[0];
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { FSharpRef, Record } from "../fable_modules/fable-library-js.5.21.0/Types.js";
3
3
  import { record_type, tuple_type, list_type, class_type, string_type } from "../fable_modules/fable-library-js.5.21.0/Reflection.js";
4
- import { FSharpClass, FSharpModule, FSharpInterface, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpTypeModule_children, FSharpFunctionType, FSharpParameter, FSharpTypeModule_mapChildren, FSharpTypeReference, FSharpType, FSharpType_$reflection } from "./FsharpAST.js";
4
+ import { FSharpUnion, FSharpClass, FSharpModule, FSharpInterface, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpTypeModule_children, FSharpFunctionType, FSharpParameter, FSharpTypeModule_mapChildren, FSharpTypeReference, FSharpType, FSharpType_$reflection } from "./FsharpAST.js";
5
5
  import { ofList, FSharpMap__TryFind, tryFind, ofSeq, empty } from "../fable_modules/fable-library-js.5.21.0/Map.js";
6
6
  import { Exception, safeHash, equals, compare, compareArrays, arrayHash, equalArrays, defaultOf, int32ToString, disposeSafe, getEnumerator, comparePrimitives } from "../fable_modules/fable-library-js.5.21.0/Util.js";
7
7
  import { mapIndexed, tryFindIndex, ofSeq as ofSeq_2, maxBy, skip, take, forAll2, ofArray, indexed, sortBy, exists, forAll, filter, collect, head, tail, zip, empty as empty_1, length, map, choose, singleton, append, isEmpty as isEmpty_1 } from "../fable_modules/fable-library-js.5.21.0/List.js";
@@ -955,25 +955,45 @@ export function disambiguateOverloads(aliases, types) {
955
955
  }, types);
956
956
  }
957
957
 
958
- /**
959
- * If a type is declared twice, merge them into one.
960
- *
961
- * This can happens because TypeScript allows multiple declarations of the same type.
962
- *
963
- * Example:
964
- *
965
- * <code lang="typescript">
966
- * interface A {
967
- * a: string;
968
- * }
969
- *
970
- * interface A {
971
- * b: number;
972
- * }
973
- * </code>
974
- */
958
+ function withoutParameterNames(typ) {
959
+ if (typ.tag === 16) {
960
+ const functionType = typ.fields[0];
961
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, "", parameter.IsOptional, withoutParameterNames(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), withoutParameterNames(functionType.ReturnType))]);
962
+ }
963
+ else {
964
+ return FSharpTypeModule_mapChildren(withoutParameterNames, typ);
965
+ }
966
+ }
967
+
968
+ function unionConversions(aliases, types) {
969
+ return map((typ) => {
970
+ switch (typ.tag) {
971
+ case 1: {
972
+ const unionInfo = typ.fields[0];
973
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants, List_distinctBy((arg) => withoutParameterNames(signatureType(aliases, arg)), choose((_arg) => {
974
+ if (_arg.tag === 2) {
975
+ return _arg.fields[1];
976
+ }
977
+ else {
978
+ return undefined;
979
+ }
980
+ }, unionInfo.Cases), {
981
+ Equals: equals,
982
+ GetHashCode: (x) => (safeHash(x) | 0),
983
+ }))]);
984
+ }
985
+ case 4: {
986
+ const moduleInfo = typ.fields[0];
987
+ return new FSharpType(/* Module */ 4, [new FSharpModule(moduleInfo.Name, moduleInfo.IsRecursive, moduleInfo.ImportSpecifier, unionConversions(aliases, moduleInfo.Types))]);
988
+ }
989
+ default:
990
+ return typ;
991
+ }
992
+ }, types);
993
+ }
994
+
975
995
  export function applyWith(aliases, types) {
976
- return distinctMembers(aliases, dropEmptyModules(mergeModules(aliases, mergeTypes(aliases, types))));
996
+ return unionConversions(aliases, distinctMembers(aliases, dropEmptyModules(mergeModules(aliases, mergeTypes(aliases, types)))));
977
997
  }
978
998
 
979
999
  export function apply(types) {
@@ -7,13 +7,12 @@ import { trimStart, interpolate, substring, join, replace, concat, isNullOrWhite
7
7
  import { splitLines, replace as replace_1, removeSingleQuote, removeDoubleQuote, capitalizeFirstLetter } from "./Utils/String.js";
8
8
  import { isDigit2 } from "../fable_modules/fable-library-js.5.21.0/Char.js";
9
9
  import { cons, mapIndexed, empty, forAll, ofArray, concat as concat_1, partition, length, singleton, append, choose, filter, iterateIndexed, iterate, isEmpty, map, exists } from "../fable_modules/fable-library-js.5.21.0/List.js";
10
- import { stringHash, disposeSafe, getEnumerator, int32ToString, Exception } from "../fable_modules/fable-library-js.5.21.0/Util.js";
10
+ import { disposeSafe, getEnumerator, int32ToString, Exception } from "../fable_modules/fable-library-js.5.21.0/Util.js";
11
11
  import { sanitizeTypeParameterName } from "./Utils/Naming.js";
12
12
  import { escape, create, isMatch, replace as replace_2 } from "../fable_modules/fable-library-js.5.21.0/RegExp.js";
13
13
  import { removeConsecutiveEmptyLines, trimEmptyLines } from "./Utils/List.js";
14
14
  import { FSharpInterface, FSharpAttribute } from "./FsharpAST.js";
15
15
  import { singleton as singleton_1, append as append_1, delay, toList } from "../fable_modules/fable-library-js.5.21.0/Seq.js";
16
- import { List_distinctBy } from "../fable_modules/fable-library-js.5.21.0/Seq2.js";
17
16
 
18
17
  export class Printer {
19
18
  constructor() {
@@ -978,7 +977,7 @@ function printUnion(printer, unionInfo) {
978
977
  }
979
978
  }, unionInfo.Attributes)) {
980
979
  const returnType = printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters);
981
- iterate((caseType_1) => {
980
+ iterate((caseType) => {
982
981
  const enumerator = getEnumerator(["op_Implicit", "op_ErasedCast"]);
983
982
  try {
984
983
  while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
@@ -986,40 +985,23 @@ function printUnion(printer, unionInfo) {
986
985
  Printer__get_NewLine(printer);
987
986
  Printer__Write_Z721C83C5(printer, "[<Emit(\"$0\")>]");
988
987
  Printer__get_NewLine(printer);
989
- Printer__Write_Z721C83C5(printer, `static member ${name_2}(value: ${caseType_1}) : ${returnType} = nativeOnly`);
988
+ Printer__Write_Z721C83C5(printer, `static member ${name_2}(value: ${caseType}) : ${returnType} = nativeOnly`);
990
989
  Printer__get_NewLine(printer);
991
990
  }
992
991
  }
993
992
  finally {
994
993
  disposeSafe(enumerator);
995
994
  }
996
- }, List_distinctBy((caseType) => {
997
- if (caseType === "JS.Uint8ClampedArray") {
998
- return "JS.Uint8Array";
999
- }
1000
- else {
1001
- return caseType;
1002
- }
1003
- }, choose((_arg_1) => {
995
+ }, map(printType, unionInfo.Conversions));
996
+ iterate((_arg_1) => {
1004
997
  if (_arg_1.tag === 2) {
1005
- return printType(_arg_1.fields[1]);
1006
- }
1007
- else {
1008
- return undefined;
1009
- }
1010
- }, unionInfo.Cases), {
1011
- Equals: (x, y) => (x === y),
1012
- GetHashCode: (x) => (stringHash(x) | 0),
1013
- }));
1014
- iterate((_arg_2) => {
1015
- if (_arg_2.tag === 2) {
1016
- const caseName = _arg_2.fields[0];
998
+ const caseName = _arg_1.fields[0];
1017
999
  Printer__get_NewLine(printer);
1018
1000
  Printer__Write_Z721C83C5(printer, concat("/// Unchecked, the value as <c>", caseName, "</c> whatever case it holds"));
1019
1001
  Printer__get_NewLine(printer);
1020
1002
  Printer__Write_Z721C83C5(printer, "[<Emit(\"$0\")>]");
1021
1003
  Printer__get_NewLine(printer);
1022
- Printer__Write_Z721C83C5(printer, `member _.As${caseName}: ${printType(_arg_2.fields[1])} = nativeOnly`);
1004
+ Printer__Write_Z721C83C5(printer, `member _.As${caseName}: ${printType(_arg_1.fields[1])} = nativeOnly`);
1023
1005
  Printer__get_NewLine(printer);
1024
1006
  }
1025
1007
  }, unionInfo.Cases);
@@ -557,7 +557,7 @@ function UtilityType_readonlyUnion(context, interfaces) {
557
557
  return referenceToExposed(context, name, empty());
558
558
  }
559
559
  else {
560
- return new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), name, map((Item_3) => (new FSharpUnionCase(/* Typed */ 1, [Item_3])), caseTypes), false, empty(), empty())]);
560
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), name, map((Item_3) => (new FSharpUnionCase(/* Typed */ 1, [Item_3])), caseTypes), false, empty(), empty(), empty())]);
561
561
  }
562
562
  }
563
563
 
@@ -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());
936
+ }, names)) ? map(value_7, names) : mapIndexed((index, _arg) => (`Case${index + 1}`), caseTypes), caseTypes), false, typeParameters, empty(), empty());
937
937
  }
938
938
 
939
939
  function referenceToExposed(context, name, typeParameterNames) {
@@ -1024,7 +1024,7 @@ function transformUnionType(context, cases) {
1024
1024
  }
1025
1025
  default: {
1026
1026
  const cases_1 = map((Item_1) => (new FSharpUnionCase(/* Typed */ 1, [Item_1])), caseTypes);
1027
- return new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), `U${length(caseTypes)}`, cases_1, isOptional, empty(), empty())]);
1027
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), `U${length(caseTypes)}`, cases_1, isOptional, empty(), empty(), empty())]);
1028
1028
  }
1029
1029
  }
1030
1030
  }
@@ -1036,7 +1036,7 @@ function transformUnionType(context, cases) {
1036
1036
  });
1037
1037
  let option_3;
1038
1038
  const option_1 = tryOptimizeUnionType(context, name, others_1);
1039
- 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)]))) : typ)) : undefined);
1039
+ 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
1040
  if (option_3 != null) {
1041
1041
  TransformContext__ExposeType_Z1D58A540(context, option_3);
1042
1042
  }
@@ -2757,7 +2757,7 @@ function paramObjectParameterSets(context, members) {
2757
2757
  const context_1 = sanitizeNameAndPushScope(parameter.Name, context)[1];
2758
2758
  void (TransformContext__get_State(context_1).UnionAliasesBeingExpanded.push(fullName_2));
2759
2759
  try {
2760
- return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional ? true : nullable_1, new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), "", map((arg_1) => (new FSharpUnionCase(/* Typed */ 1, [transformType(context_1, arrayAsInput(arg_1))])), cases_1), false, empty(), empty())]), parameter.OriginalGlueMember);
2760
+ return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional ? true : nullable_1, new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), "", map((arg_1) => (new FSharpUnionCase(/* Typed */ 1, [transformType(context_1, arrayAsInput(arg_1))])), cases_1), false, empty(), empty(), empty())]), parameter.OriginalGlueMember);
2761
2761
  }
2762
2762
  finally {
2763
2763
  TransformContext__get_State(context_1).UnionAliasesBeingExpanded.splice(TransformContext__get_State(context_1).UnionAliasesBeingExpanded.length - 1, 1);
@@ -3297,7 +3297,7 @@ export function TypeAliasDeclaration_tryTransformKeyOf(aliasName, glueType) {
3297
3297
  return undefined;
3298
3298
  }
3299
3299
  else {
3300
- return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* StringEnum */ 12, [0])]), sanitizeTypeName(aliasName), cases, false, empty(), empty())]);
3300
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* StringEnum */ 12, [0])]), sanitizeTypeName(aliasName), cases, false, empty(), empty(), empty())]);
3301
3301
  }
3302
3302
  }
3303
3303
 
@@ -3327,7 +3327,7 @@ export function TypeAliasDeclaration_transformLiteral(xmlDoc, typeAliasName, lit
3327
3327
  default: {
3328
3328
  const value = literalInfo.fields[0];
3329
3329
  const sanitizeResult = sanitizeTypeNameWithResult(value);
3330
- return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* StringEnum */ 12, [0])]), typeAliasName, singleton(new FSharpUnionCase(/* Named */ 0, [new FSharpUnionCaseNamed(toList(delay(() => (sanitizeResult.IsDifferent ? singleton_1(new FSharpAttribute(/* CompiledName */ 13, [removeSurroundingQuotes(value)])) : empty_1()))), sanitizeResult.Name)])), false, empty(), empty())]);
3330
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, new FSharpAttribute(/* StringEnum */ 12, [0])]), typeAliasName, singleton(new FSharpUnionCase(/* Named */ 0, [new FSharpUnionCaseNamed(toList(delay(() => (sanitizeResult.IsDifferent ? singleton_1(new FSharpAttribute(/* CompiledName */ 13, [removeSurroundingQuotes(value)])) : empty_1()))), sanitizeResult.Name)])), false, empty(), empty(), empty())]);
3331
3331
  }
3332
3332
  }
3333
3333
  }
@@ -3975,7 +3975,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
3975
3975
  GetHashCode: (x_6) => (safeHash(x_6) | 0),
3976
3976
  })));
3977
3977
  const fieldCases_1 = transformFieldCases(literalCases_1);
3978
- 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())]);
3978
+ 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
3979
  }
3980
3980
  else if (isNumericOnly && !isEmpty(otherCases)) {
3981
3981
  const literalCases_2 = List_distinct(map((value_3) => {
@@ -4002,7 +4002,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4002
4002
  Equals: equals,
4003
4003
  GetHashCode: (x_7) => (safeHash(x_7) | 0),
4004
4004
  });
4005
- 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())]);
4005
+ 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
4006
  }
4007
4007
  else if (isNumericOnly) {
4008
4008
  return new FSharpType(/* Enum */ 0, [new FSharpEnum(typeName, List_distinct(map((value_5) => {
@@ -4046,7 +4046,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4046
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
4047
  }, filter((property_3) => (property_3.Name !== tagName_1), tupledArg_1[1][1]))]);
4048
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())]);
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())]);
4050
4050
  }
4051
4051
  }
4052
4052
 
@@ -4329,7 +4329,7 @@ function aliasOfUnion(scope, cases, unionType) {
4329
4329
  }
4330
4330
  }
4331
4331
  else {
4332
- return (matchValue.tag === 1) ? ((unionInfo = matchValue.fields[0], new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, scope.TypeParameters.Value.TypeParameters, unionInfo.Constants)]))) : ((typ = matchValue, typ));
4332
+ return (matchValue.tag === 1) ? ((unionInfo = matchValue.fields[0], new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, scope.TypeParameters.Value.TypeParameters, unionInfo.Constants, unionInfo.Conversions)]))) : ((typ = matchValue, typ));
4333
4333
  }
4334
4334
  }
4335
4335
  }
@@ -128,7 +128,7 @@ export function withoutName(typ) {
128
128
  }
129
129
  case 1: {
130
130
  const info_3 = typ.fields[0];
131
- return new FSharpType(/* Union */ 1, [new FSharpUnion(info_3.Attributes, "", info_3.Cases, info_3.IsOptional, info_3.TypeParameters, info_3.Constants)]);
131
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(info_3.Attributes, "", info_3.Cases, info_3.IsOptional, info_3.TypeParameters, info_3.Constants, info_3.Conversions)]);
132
132
  }
133
133
  case 0:
134
134
  return new FSharpType(/* Enum */ 0, [new FSharpEnum("", typ.fields[0].Cases)]);
@@ -47,7 +47,7 @@ export function transformEnum(glueEnum) {
47
47
  }, stringValues), {
48
48
  Equals: equals,
49
49
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
50
- }), false, empty(), empty())]);
50
+ }), false, empty(), empty(), empty())]);
51
51
  }
52
52
  }
53
53
  else if (isEmpty(stringValues)) {
@@ -74,7 +74,7 @@ export function transformEnum(glueEnum) {
74
74
  return constant("String", (arg = removeSurroundingQuotes(matchValue_4.fields[0]), toText(printf("%A"))(arg)));
75
75
  }
76
76
  }, glueEnum.Members);
77
- return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, FSharpAttribute.Erase]), name, toList(delay(() => append(exists((constant_1) => (constant_1.Case === "String"), constants) ? singleton(new FSharpUnionCase(/* Field */ 2, ["String", new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$])])) : empty_1(), delay(() => (exists((constant_2) => (constant_2.Case === "Number"), constants) ? singleton(new FSharpUnionCase(/* Field */ 2, ["Number", new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Float])])) : empty_1()))))), false, empty(), constants)]);
77
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(ofArray([FSharpAttribute.RequireQualifiedAccess, FSharpAttribute.Erase]), name, toList(delay(() => append(exists((constant_1) => (constant_1.Case === "String"), constants) ? singleton(new FSharpUnionCase(/* Field */ 2, ["String", new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$])])) : empty_1(), delay(() => (exists((constant_2) => (constant_2.Case === "Number"), constants) ? singleton(new FSharpUnionCase(/* Field */ 2, ["Number", new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Float])])) : empty_1()))))), false, empty(), constants, empty())]);
78
78
  }
79
79
  }
80
80
 
@@ -161,7 +161,7 @@ export function mapFSharpType(seadledTypes, typ) {
161
161
  default:
162
162
  return case$;
163
163
  }
164
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
164
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants, unionInfo.Conversions)]);
165
165
  case 6:
166
166
  return new FSharpType(/* Tuple */ 12, [map((typ_6) => mapFSharpType(seadledTypes, typ_6), types)]);
167
167
  case 7:
@@ -41,7 +41,7 @@ export function tryUnwrapOption(typ) {
41
41
  case 0:
42
42
  return underlyingType;
43
43
  case 1:
44
- return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo_1.Attributes, unionInfo_1.Name, unionInfo_1.Cases, false, unionInfo_1.TypeParameters, unionInfo_1.Constants)]);
44
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo_1.Attributes, unionInfo_1.Name, unionInfo_1.Cases, false, unionInfo_1.TypeParameters, unionInfo_1.Constants, unionInfo_1.Conversions)]);
45
45
  default:
46
46
  return undefined;
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glutinum/cli",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.13",
4
4
  "description": "TypeScript definition to F# bindings converter",
5
5
  "type": "module",
6
6
  "main": "index.js",