@fable-org/fable-library-js 2.0.0-beta.3 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Array.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { int32 } from "./Int32.js";
2
2
  import { Option } from "./Option.js";
3
- import { IComparer, IEqualityComparer } from "./Util.js";
3
+ import { IComparer, Nullable, IEqualityComparer } from "./Util.js";
4
4
  import { FSharpRef } from "./Types.js";
5
5
  export declare function append<T>(array1: T[], array2: T[], cons?: any): T[];
6
6
  export declare function filter<T>(predicate: ((arg0: T) => boolean), array: T[]): T[];
@@ -23,7 +23,7 @@ export declare function collect<T, U>(mapping: ((arg0: T) => U[]), array: T[], c
23
23
  export declare function where<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): $a[];
24
24
  export declare function indexOf<T>(array: T[], item_1: T, start: Option<int32>, count: Option<int32>, eq: IEqualityComparer<T>): int32;
25
25
  export declare function contains<T>(value: T, array: T[], eq: IEqualityComparer<T>): boolean;
26
- export declare function empty<$a>(cons: any): $a[];
26
+ export declare function empty<$a>(cons: Nullable<any>): $a[];
27
27
  export declare function singleton<T>(value: T, cons?: any): T[];
28
28
  export declare function initialize<T>(count: int32, initializer: ((arg0: int32) => T), cons?: any): T[];
29
29
  export declare function pairwise<T>(array: T[]): [T, T][];
@@ -82,7 +82,7 @@ export declare function chunkBySize<T>(chunkSize: int32, array: T[]): T[][];
82
82
  export declare function splitAt<T>(index: int32, array: T[]): [T[], T[]];
83
83
  export declare function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
84
84
  export declare function compareTo<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
85
- export declare function equalsWith<T>(equals: ((arg0: T, arg1: T) => boolean), array1: T[], array2: T[]): boolean;
85
+ export declare function equalsWith<T>(equals: ((arg0: T, arg1: T) => boolean), source1: T[], source2: T[]): boolean;
86
86
  export declare function exactlyOne<T>(array: T[]): T;
87
87
  export declare function tryExactlyOne<T>(array: T[]): Option<T>;
88
88
  export declare function head<T>(array: T[]): T;
package/Array.js CHANGED
@@ -2,7 +2,7 @@ import { Helpers_allocateArrayFromCons } from "./Native.js";
2
2
  import { setItem as setItem_1, item as item_2 } from "./Array.js";
3
3
  import { value as value_2, map as map_1, defaultArg, some } from "./Option.js";
4
4
  import { min as min_1, max as max_1 } from "./Double.js";
5
- import { equals as equals_1, disposeSafe, getEnumerator, copyToArray, defaultOf } from "./Util.js";
5
+ import { disposeSafe, getEnumerator, copyToArray, defaultOf } from "./Util.js";
6
6
  import { SR_indexOutOfBounds } from "./Global.js";
7
7
  import { Operators_IsNull } from "./FSharp.Core.js";
8
8
  function indexNotFound() {
@@ -574,7 +574,7 @@ export function choose(chooser, array, cons) {
574
574
  res.push(y);
575
575
  }
576
576
  }
577
- if (equals_1(cons, defaultOf())) {
577
+ if (cons == null) {
578
578
  return res;
579
579
  }
580
580
  else {
@@ -841,23 +841,23 @@ export function compareTo(comparer, source1, source2) {
841
841
  }
842
842
  }
843
843
  }
844
- export function equalsWith(equals, array1, array2) {
845
- if (Operators_IsNull(array1)) {
846
- if (Operators_IsNull(array2)) {
844
+ export function equalsWith(equals, source1, source2) {
845
+ if (Operators_IsNull(source1)) {
846
+ if (Operators_IsNull(source2)) {
847
847
  return true;
848
848
  }
849
849
  else {
850
850
  return false;
851
851
  }
852
852
  }
853
- else if (Operators_IsNull(array2)) {
853
+ else if (Operators_IsNull(source2)) {
854
854
  return false;
855
855
  }
856
856
  else {
857
857
  let i = 0;
858
858
  let result = true;
859
- const length1 = array1.length | 0;
860
- const length2 = array2.length | 0;
859
+ const length1 = source1.length | 0;
860
+ const length2 = source2.length | 0;
861
861
  if (length1 > length2) {
862
862
  return false;
863
863
  }
@@ -866,7 +866,7 @@ export function equalsWith(equals, array1, array2) {
866
866
  }
867
867
  else {
868
868
  while ((i < length1) && result) {
869
- result = equals(item_2(i, array1), item_2(i, array2));
869
+ result = equals(item_2(i, source1), item_2(i, source2));
870
870
  i = ((i + 1) | 0);
871
871
  }
872
872
  return result;
package/BitConverter.d.ts CHANGED
@@ -2,16 +2,16 @@ import { uint8, int16, uint16, int32, uint32, float32, float64 } from "./Int32.j
2
2
  import { int64, uint64 } from "./BigInt.js";
3
3
  import { char } from "./Char.js";
4
4
  export declare function isLittleEndian(): boolean;
5
- export declare function getBytesBoolean(value: boolean): Uint8Array;
6
- export declare function getBytesChar(value: char): Uint8Array;
7
- export declare function getBytesInt16(value: int16): Uint8Array;
8
- export declare function getBytesInt32(value: int32): Uint8Array;
9
- export declare function getBytesInt64(value: int64): Uint8Array;
10
- export declare function getBytesUInt16(value: uint16): Uint8Array;
11
- export declare function getBytesUInt32(value: uint32): Uint8Array;
12
- export declare function getBytesUInt64(value: uint64): Uint8Array;
13
- export declare function getBytesSingle(value: float32): Uint8Array;
14
- export declare function getBytesDouble(value: float64): Uint8Array;
5
+ export declare function getBytesBoolean(value: boolean): Uint8Array<ArrayBuffer>;
6
+ export declare function getBytesChar(value: char): Uint8Array<ArrayBuffer>;
7
+ export declare function getBytesInt16(value: int16): Uint8Array<ArrayBuffer>;
8
+ export declare function getBytesInt32(value: int32): Uint8Array<ArrayBuffer>;
9
+ export declare function getBytesInt64(value: int64): Uint8Array<ArrayBuffer>;
10
+ export declare function getBytesUInt16(value: uint16): Uint8Array<ArrayBuffer>;
11
+ export declare function getBytesUInt32(value: uint32): Uint8Array<ArrayBuffer>;
12
+ export declare function getBytesUInt64(value: uint64): Uint8Array<ArrayBuffer>;
13
+ export declare function getBytesSingle(value: float32): Uint8Array<ArrayBuffer>;
14
+ export declare function getBytesDouble(value: float64): Uint8Array<ArrayBuffer>;
15
15
  export declare function int64BitsToDouble(value: int64): float64;
16
16
  export declare function doubleToInt64Bits(value: float64): int64;
17
17
  export declare function toBoolean(bytes: ArrayLike<uint8>, offset: int32): boolean;
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 2.0.0-beta.4 - 2025-07-25
11
+
12
+ * [JS/TS] Initial support for Nullable Reference Types (by @ncave)
13
+
10
14
  ## 2.0.0-beta.3 - 2025-03-14
11
15
 
12
16
  ### Fixed
package/Encoding.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { uint8 } from "./Int32.js";
2
2
  declare class UTF16LE {
3
- getBytes(str: string | string[], index?: number, count?: number): Uint8Array;
3
+ getBytes(str: string | string[], index?: number, count?: number): Uint8Array<ArrayBuffer>;
4
4
  getString(bytes: ArrayLike<uint8>, index?: number, count?: number): string;
5
5
  }
6
6
  declare class UTF8 {
7
- getBytes(str: string | string[], index?: number, count?: number): Uint8Array;
7
+ getBytes(str: string | string[], index?: number, count?: number): Uint8Array<ArrayBuffer>;
8
8
  getString(bytes: ArrayLike<uint8>, index?: number, count?: number): string;
9
9
  }
10
10
  export declare function get_Unicode(): UTF16LE;
@@ -1,7 +1,7 @@
1
+ import { IComparer, IEqualityComparer, Nullable } from "./Util.js";
1
2
  import { int32 } from "./Int32.js";
2
- import { IComparer, IEqualityComparer } from "./Util.js";
3
- export declare function HashIdentity_FromFunctions<T>(hash: ((arg0: T) => int32), eq: ((arg0: T, arg1: T) => boolean)): IEqualityComparer<T>;
3
+ export declare function HashIdentity_FromFunctions<T>(hash: ((arg0: T) => int32), eq: ((arg0: Nullable<T>, arg1: Nullable<T>) => boolean)): IEqualityComparer<T>;
4
4
  export declare function HashIdentity_Structural<T>(): IEqualityComparer<T>;
5
5
  export declare function HashIdentity_Reference<T>(): IEqualityComparer<T>;
6
- export declare function ComparisonIdentity_FromFunction<T>(comparer: ((arg0: T, arg1: T) => int32)): IComparer<T>;
6
+ export declare function ComparisonIdentity_FromFunction<T>(comparer: ((arg0: Nullable<T>, arg1: Nullable<T>) => int32)): IComparer<T>;
7
7
  export declare function ComparisonIdentity_Structural<T>(): IComparer<T>;
@@ -1,4 +1,4 @@
1
- import { compare, physicalHash, equals, structuralHash } from "./Util.js";
1
+ import { compare, physicalHash, nullableEquals, structuralHash } from "./Util.js";
2
2
  export function HashIdentity_FromFunctions(hash, eq) {
3
3
  return {
4
4
  Equals(x, y) {
@@ -10,10 +10,10 @@ export function HashIdentity_FromFunctions(hash, eq) {
10
10
  };
11
11
  }
12
12
  export function HashIdentity_Structural() {
13
- return HashIdentity_FromFunctions((obj) => (structuralHash(obj) | 0), equals);
13
+ return HashIdentity_FromFunctions((obj) => (structuralHash(obj) | 0), nullableEquals);
14
14
  }
15
15
  export function HashIdentity_Reference() {
16
- return HashIdentity_FromFunctions((obj) => (physicalHash(obj) | 0), (e, e_1) => (e === e_1));
16
+ return HashIdentity_FromFunctions((obj) => (physicalHash(obj) | 0), nullableEquals);
17
17
  }
18
18
  export function ComparisonIdentity_FromFunction(comparer) {
19
19
  return {
package/FSharp.Core.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { IDisposable, IEqualityComparer, IComparer } from "./Util.js";
2
- import { Nullable, Option } from "./Option.js";
1
+ import { IDisposable, IEqualityComparer, IComparer, Nullable } from "./Util.js";
2
+ import { Option } from "./Option.js";
3
3
  import { FSharpChoice$2_$union } from "./Choice.js";
4
- import { StringBuilder } from "./System.Text.js";
5
4
  export declare const LanguagePrimitives_GenericEqualityComparer: any;
6
5
  export declare const LanguagePrimitives_GenericEqualityERComparer: any;
7
6
  export declare function LanguagePrimitives_FastGenericComparer<T>(): IComparer<T>;
@@ -16,16 +15,16 @@ export declare function Operators_Lock<$a, $b>(_lockObj: $a, action: (() => $b))
16
15
  export declare function Operators_IsNull<T>(value: T): boolean;
17
16
  export declare function Operators_IsNotNull<T>(value: T): boolean;
18
17
  export declare function Operators_IsNullV<T extends any>(value: Nullable<T>): boolean;
19
- export declare function Operators_NonNull<T>(value: T): T;
18
+ export declare function Operators_NonNull<T>(value: Nullable<T>): T;
20
19
  export declare function Operators_NonNullV<T extends any>(value: Nullable<T>): T;
21
- export declare function Operators_NullMatchPattern<T>(value: T): FSharpChoice$2_$union<void, T>;
20
+ export declare function Operators_NullMatchPattern<T>(value: Nullable<T>): FSharpChoice$2_$union<void, T>;
22
21
  export declare function Operators_NullValueMatchPattern<T extends any>(value: Nullable<T>): FSharpChoice$2_$union<void, T>;
23
- export declare function Operators_NonNullQuickPattern<T>(value: T): T;
22
+ export declare function Operators_NonNullQuickPattern<T>(value: Nullable<T>): T;
24
23
  export declare function Operators_NonNullQuickValuePattern<T extends any>(value: Nullable<T>): T;
25
24
  export declare function Operators_WithNull<T>(value: T): T;
26
25
  export declare function Operators_WithNullV<T extends any>(value: T): T;
27
26
  export declare function Operators_NullV<T extends any>(): Nullable<T>;
28
- export declare function Operators_NullArgCheck<T>(argumentName: string, value: T): T;
27
+ export declare function Operators_NullArgCheck<T>(argumentName: string, value: Nullable<T>): T;
29
28
  export declare function ExtraTopLevelOperators_LazyPattern<$a>(input: any): $a;
30
- export declare function PrintfModule_PrintFormatToStringBuilderThen<$a, $b>(continuation: (() => $a), builder: StringBuilder, format: any): $b;
31
- export declare function PrintfModule_PrintFormatToStringBuilder<$a>(builder: StringBuilder, format: any): $a;
29
+ export declare function PrintfModule_PrintFormatToStringBuilderThen<$a, $b>(continuation: (() => $a), builder: any, format: any): $b;
30
+ export declare function PrintfModule_PrintFormatToStringBuilder<$a>(builder: any, format: any): $a;
package/FSharp.Core.js CHANGED
@@ -1,12 +1,12 @@
1
- import { disposeSafe, defaultOf, structuralHash, equals } from "./Util.js";
1
+ import { disposeSafe, structuralHash, nullableEquals } from "./Util.js";
2
2
  import { HashIdentity_Structural, ComparisonIdentity_Structural } from "./FSharp.Collections.js";
3
- import { value as value_1 } from "./Option.js";
3
+ import { nonNullValue } from "./Option.js";
4
4
  import { FSharpChoice$2_Choice2Of2, FSharpChoice$2_Choice1Of2 } from "./Choice.js";
5
5
  import { concat } from "./String.js";
6
6
  import { StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
7
7
  export const LanguagePrimitives_GenericEqualityComparer = {
8
8
  "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
9
- return equals(x, y);
9
+ return nullableEquals(x, y);
10
10
  },
11
11
  "System.Collections.IEqualityComparer.GetHashCode4E60E31B"(x_1) {
12
12
  return structuralHash(x_1) | 0;
@@ -14,7 +14,7 @@ export const LanguagePrimitives_GenericEqualityComparer = {
14
14
  };
15
15
  export const LanguagePrimitives_GenericEqualityERComparer = {
16
16
  "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
17
- return equals(x, y);
17
+ return nullableEquals(x, y);
18
18
  },
19
19
  "System.Collections.IEqualityComparer.GetHashCode4E60E31B"(x_1) {
20
20
  return structuralHash(x_1) | 0;
@@ -46,7 +46,7 @@ export function Operators_Using(resource, action) {
46
46
  return action(resource);
47
47
  }
48
48
  finally {
49
- if (equals(resource, defaultOf())) {
49
+ if (resource == null) {
50
50
  }
51
51
  else {
52
52
  let copyOfStruct = resource;
@@ -58,7 +58,7 @@ export function Operators_Lock(_lockObj, action) {
58
58
  return action();
59
59
  }
60
60
  export function Operators_IsNull(value) {
61
- if (equals(value, defaultOf())) {
61
+ if (value == null) {
62
62
  return true;
63
63
  }
64
64
  else {
@@ -66,7 +66,7 @@ export function Operators_IsNull(value) {
66
66
  }
67
67
  }
68
68
  export function Operators_IsNotNull(value) {
69
- if (equals(value, defaultOf())) {
69
+ if (value == null) {
70
70
  return false;
71
71
  }
72
72
  else {
@@ -77,7 +77,7 @@ export function Operators_IsNullV(value) {
77
77
  return !(value != null);
78
78
  }
79
79
  export function Operators_NonNull(value) {
80
- if (equals(value, defaultOf())) {
80
+ if (value == null) {
81
81
  throw new Error();
82
82
  }
83
83
  else {
@@ -86,14 +86,14 @@ export function Operators_NonNull(value) {
86
86
  }
87
87
  export function Operators_NonNullV(value) {
88
88
  if (value != null) {
89
- return value_1(value);
89
+ return nonNullValue(value);
90
90
  }
91
91
  else {
92
92
  throw new Error();
93
93
  }
94
94
  }
95
95
  export function Operators_NullMatchPattern(value) {
96
- if (equals(value, defaultOf())) {
96
+ if (value == null) {
97
97
  return FSharpChoice$2_Choice1Of2(undefined);
98
98
  }
99
99
  else {
@@ -102,14 +102,14 @@ export function Operators_NullMatchPattern(value) {
102
102
  }
103
103
  export function Operators_NullValueMatchPattern(value) {
104
104
  if (value != null) {
105
- return FSharpChoice$2_Choice2Of2(value_1(value));
105
+ return FSharpChoice$2_Choice2Of2(nonNullValue(value));
106
106
  }
107
107
  else {
108
108
  return FSharpChoice$2_Choice1Of2(undefined);
109
109
  }
110
110
  }
111
111
  export function Operators_NonNullQuickPattern(value) {
112
- if (equals(value, defaultOf())) {
112
+ if (value == null) {
113
113
  throw new Error();
114
114
  }
115
115
  else {
@@ -118,7 +118,7 @@ export function Operators_NonNullQuickPattern(value) {
118
118
  }
119
119
  export function Operators_NonNullQuickValuePattern(value) {
120
120
  if (value != null) {
121
- return value_1(value);
121
+ return nonNullValue(value);
122
122
  }
123
123
  else {
124
124
  throw new Error();
@@ -131,10 +131,10 @@ export function Operators_WithNullV(value) {
131
131
  return value;
132
132
  }
133
133
  export function Operators_NullV() {
134
- return defaultOf();
134
+ return null;
135
135
  }
136
136
  export function Operators_NullArgCheck(argumentName, value) {
137
- if (equals(value, defaultOf())) {
137
+ if (value == null) {
138
138
  throw new Error(concat("Value cannot be null. (Parameter \'", argumentName, ..."\')"));
139
139
  }
140
140
  else {
package/List.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Option } from "./Option.js";
2
- import { IComparer, IEqualityComparer, IDisposable, IEnumerator } from "./Util.js";
2
+ import { IComparer, IEqualityComparer, IDisposable, IEnumerator, Nullable } from "./Util.js";
3
3
  import { int32 } from "./Int32.js";
4
4
  import { Record } from "./Types.js";
5
5
  import { TypeInfo } from "./Reflection.js";
@@ -8,10 +8,10 @@ export declare class FSharpList<T> extends Record implements Iterable<T> {
8
8
  tail: Option<FSharpList<T>>;
9
9
  constructor(head: T, tail: Option<FSharpList<T>>);
10
10
  toString(): string;
11
- Equals(other: any): boolean;
11
+ Equals(other: Nullable<any>): boolean;
12
12
  GetHashCode(): int32;
13
13
  toJSON(): any;
14
- CompareTo(other: any): int32;
14
+ CompareTo(other: Nullable<any>): int32;
15
15
  GetEnumerator(): IEnumerator<T>;
16
16
  [Symbol.iterator](): Iterator<T>;
17
17
  "System.Collections.IEnumerable.GetEnumerator"(): IEnumerator<any>;
@@ -23,7 +23,7 @@ export declare class ListEnumerator$1<T> implements IEnumerator<T>, IDisposable
23
23
  current: T;
24
24
  constructor(xs: FSharpList<T>);
25
25
  "System.Collections.Generic.IEnumerator`1.get_Current"(): T;
26
- "System.Collections.IEnumerator.get_Current"(): any;
26
+ "System.Collections.IEnumerator.get_Current"(): Nullable<any>;
27
27
  "System.Collections.IEnumerator.MoveNext"(): boolean;
28
28
  "System.Collections.IEnumerator.Reset"(): void;
29
29
  Dispose(): void;
package/List.js CHANGED
@@ -20,7 +20,8 @@ export class FSharpList extends Record {
20
20
  if (xs === other) {
21
21
  return true;
22
22
  }
23
- else {
23
+ else if (other instanceof FSharpList) {
24
+ const ys = other;
24
25
  const loop = (xs_1_mut, ys_1_mut) => {
25
26
  loop: while (true) {
26
27
  const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
@@ -52,7 +53,10 @@ export class FSharpList extends Record {
52
53
  break;
53
54
  }
54
55
  };
55
- return loop(xs, other);
56
+ return loop(xs, ys);
57
+ }
58
+ else {
59
+ return false;
56
60
  }
57
61
  }
58
62
  GetHashCode() {
@@ -87,39 +91,45 @@ export class FSharpList extends Record {
87
91
  }
88
92
  CompareTo(other) {
89
93
  const xs = this;
90
- const loop = (xs_1_mut, ys_1_mut) => {
91
- loop: while (true) {
92
- const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
93
- const matchValue = xs_1.tail;
94
- const matchValue_1 = ys_1.tail;
95
- if (matchValue != null) {
96
- if (matchValue_1 != null) {
97
- const xt = value_1(matchValue);
98
- const yt = value_1(matchValue_1);
99
- const c = compare(xs_1.head, ys_1.head) | 0;
100
- if (c === 0) {
101
- xs_1_mut = xt;
102
- ys_1_mut = yt;
103
- continue loop;
94
+ if (other instanceof FSharpList) {
95
+ const ys = other;
96
+ const loop = (xs_1_mut, ys_1_mut) => {
97
+ loop: while (true) {
98
+ const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
99
+ const matchValue = xs_1.tail;
100
+ const matchValue_1 = ys_1.tail;
101
+ if (matchValue != null) {
102
+ if (matchValue_1 != null) {
103
+ const xt = value_1(matchValue);
104
+ const yt = value_1(matchValue_1);
105
+ const c = compare(xs_1.head, ys_1.head) | 0;
106
+ if (c === 0) {
107
+ xs_1_mut = xt;
108
+ ys_1_mut = yt;
109
+ continue loop;
110
+ }
111
+ else {
112
+ return c | 0;
113
+ }
104
114
  }
105
115
  else {
106
- return c | 0;
116
+ return 1;
107
117
  }
108
118
  }
119
+ else if (matchValue_1 != null) {
120
+ return -1;
121
+ }
109
122
  else {
110
- return 1;
123
+ return 0;
111
124
  }
125
+ break;
112
126
  }
113
- else if (matchValue_1 != null) {
114
- return -1;
115
- }
116
- else {
117
- return 0;
118
- }
119
- break;
120
- }
121
- };
122
- return loop(xs, other) | 0;
127
+ };
128
+ return loop(xs, ys) | 0;
129
+ }
130
+ else {
131
+ return 1;
132
+ }
123
133
  }
124
134
  GetEnumerator() {
125
135
  const xs = this;
package/Map.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TypeInfo } from "./Reflection.js";
2
2
  import { Option } from "./Option.js";
3
3
  import { int32 } from "./Int32.js";
4
- import { IMap, IEnumerator, IComparer } from "./Util.js";
4
+ import { IMap, IEnumerator, IComparer, Nullable } from "./Util.js";
5
5
  import { FSharpList } from "./List.js";
6
6
  import { FSharpRef, Record } from "./Types.js";
7
7
  export declare class MapTreeLeaf$2<Key, Value> {
@@ -39,9 +39,9 @@ export declare function MapTreeModule_filter1<Key, $a>(comparer: IComparer<Key>,
39
39
  export declare function MapTreeModule_filterAux<Key, Value>(comparer_mut: IComparer<Key>, f_mut: any, m_mut: Option<MapTreeLeaf$2<Key, Value>>, acc_mut: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>>;
40
40
  export declare function MapTreeModule_filter<Key, $a>(comparer: IComparer<Key>, f: ((arg0: Key, arg1: $a) => boolean), m: Option<MapTreeLeaf$2<Key, $a>>): Option<MapTreeLeaf$2<Key, $a>>;
41
41
  export declare function MapTreeModule_spliceOutSuccessor<Key, Value>(m: Option<MapTreeLeaf$2<Key, Value>>): [Key, Value, Option<MapTreeLeaf$2<Key, Value>>];
42
- export declare function MapTreeModule_remove<Key, Value>(comparer: IComparer<Key>, k: Key, m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>>;
42
+ export declare function MapTreeModule_remove<Key, Value>(comparer: IComparer<Key>, k: Nullable<Key>, m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>>;
43
43
  export declare function MapTreeModule_change<Key, Value>(comparer: IComparer<Key>, k: Key, u: ((arg0: Option<Value>) => Option<Value>), m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>>;
44
- export declare function MapTreeModule_mem<Key, Value>(comparer_mut: IComparer<Key>, k_mut: Key, m_mut: Option<MapTreeLeaf$2<Key, Value>>): boolean;
44
+ export declare function MapTreeModule_mem<Key, Value>(comparer_mut: IComparer<Key>, k_mut: Nullable<Key>, m_mut: Option<MapTreeLeaf$2<Key, Value>>): boolean;
45
45
  export declare function MapTreeModule_iterOpt<Key, Value>(f_mut: any, m_mut: Option<MapTreeLeaf$2<Key, Value>>): void;
46
46
  export declare function MapTreeModule_iter<$a, $b>(f: ((arg0: $a, arg1: $b) => void), m: Option<MapTreeLeaf$2<$a, $b>>): void;
47
47
  export declare function MapTreeModule_tryPickOpt<Key, Value, $a>(f_mut: any, m_mut: Option<MapTreeLeaf$2<Key, Value>>): Option<$a>;
@@ -57,8 +57,8 @@ export declare function MapTreeModule_foldBackOpt<Key, Value, $a>(f_mut: any, m_
57
57
  export declare function MapTreeModule_foldBack<$a, $b, $c>(f: ((arg0: $a, arg1: $b, arg2: $c) => $c), m: Option<MapTreeLeaf$2<$a, $b>>, x: $c): $c;
58
58
  export declare function MapTreeModule_foldOpt<$a, Key, Value>(f_mut: any, x_mut: $a, m_mut: Option<MapTreeLeaf$2<Key, Value>>): $a;
59
59
  export declare function MapTreeModule_fold<$a, $b, $c>(f: ((arg0: $a, arg1: $b, arg2: $c) => $a), x: $a, m: Option<MapTreeLeaf$2<$b, $c>>): $a;
60
- export declare function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<Key>, lo: Key, hi: Key, f: any, m: Option<MapTreeLeaf$2<Key, Value>>, x: a): a;
61
- export declare function MapTreeModule_foldSection<Key, $a, $b>(comparer: IComparer<Key>, lo: Key, hi: Key, f: ((arg0: Key, arg1: $a, arg2: $b) => $b), m: Option<MapTreeLeaf$2<Key, $a>>, x: $b): $b;
60
+ export declare function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<Key>, lo: Nullable<Key>, hi: Nullable<Key>, f: any, m: Option<MapTreeLeaf$2<Key, Value>>, x: a): a;
61
+ export declare function MapTreeModule_foldSection<$a, $b, $c>(comparer: IComparer<$a>, lo: Nullable<$a>, hi: Nullable<$a>, f: ((arg0: $a, arg1: $b, arg2: $c) => $c), m: Option<MapTreeLeaf$2<$a, $b>>, x: $c): $c;
62
62
  export declare function MapTreeModule_toList<Key, Value>(m: Option<MapTreeLeaf$2<Key, Value>>): FSharpList<[Key, Value]>;
63
63
  export declare function MapTreeModule_copyToArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>, arr: [$a, $b][], i: int32): void;
64
64
  export declare function MapTreeModule_toArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>): [$a, $b][];
@@ -87,14 +87,14 @@ export declare class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable
87
87
  readonly comparer: IComparer<Key>;
88
88
  constructor(comparer: IComparer<Key>, tree: Option<MapTreeLeaf$2<Key, Value>>);
89
89
  GetHashCode(): int32;
90
- Equals(that: any): boolean;
90
+ Equals(other: Nullable<any>): boolean;
91
91
  toString(): string;
92
92
  get [Symbol.toStringTag](): string;
93
93
  toJSON(): any;
94
94
  GetEnumerator(): IEnumerator<[Key, Value]>;
95
95
  [Symbol.iterator](): Iterator<[Key, Value]>;
96
96
  "System.Collections.IEnumerable.GetEnumerator"(): IEnumerator<any>;
97
- CompareTo(obj: any): int32;
97
+ CompareTo(other: Nullable<any>): int32;
98
98
  "System.Collections.Generic.ICollection`1.Add2B595"(x: [Key, Value]): void;
99
99
  "System.Collections.Generic.ICollection`1.Clear"(): void;
100
100
  "System.Collections.Generic.ICollection`1.Remove2B595"(x: [Key, Value]): boolean;
@@ -128,14 +128,14 @@ export declare function FSharpMap__Exists<Key, Value>(m: FSharpMap<Key, Value>,
128
128
  export declare function FSharpMap__Filter<Key, Value>(m: FSharpMap<Key, Value>, predicate: ((arg0: Key, arg1: Value) => boolean)): FSharpMap<Key, Value>;
129
129
  export declare function FSharpMap__ForAll<Key, Value>(m: FSharpMap<Key, Value>, predicate: ((arg0: Key, arg1: Value) => boolean)): boolean;
130
130
  export declare function FSharpMap__Fold<Key, Value, $a>(m: FSharpMap<Key, Value>, f: ((arg0: Key, arg1: Value, arg2: $a) => $a), acc: $a): $a;
131
- export declare function FSharpMap__FoldSection<Key, Value, z>(m: FSharpMap<Key, Value>, lo: Key, hi: Key, f: ((arg0: Key, arg1: Value, arg2: z) => z), acc: z): z;
131
+ export declare function FSharpMap__FoldSection<Key, Value, $a>(m: FSharpMap<Key, Value>, lo: Nullable<Key>, hi: Nullable<Key>, f: ((arg0: Key, arg1: Value, arg2: $a) => $a), acc: $a): $a;
132
132
  export declare function FSharpMap__Iterate<Key, Value>(m: FSharpMap<Key, Value>, f: ((arg0: Key, arg1: Value) => void)): void;
133
133
  export declare function FSharpMap__MapRange<Key, Value, Result>(m: FSharpMap<Key, Value>, f: ((arg0: Value) => Result)): FSharpMap<Key, Result>;
134
134
  export declare function FSharpMap__Map<Key, Value, b>(m: FSharpMap<Key, Value>, f: ((arg0: Key, arg1: Value) => b)): FSharpMap<Key, b>;
135
135
  export declare function FSharpMap__Partition<Key, Value>(m: FSharpMap<Key, Value>, predicate: ((arg0: Key, arg1: Value) => boolean)): [FSharpMap<Key, Value>, FSharpMap<Key, Value>];
136
136
  export declare function FSharpMap__get_Count<Key, Value>(m: FSharpMap<Key, Value>): int32;
137
- export declare function FSharpMap__ContainsKey<Key, Value>(m: FSharpMap<Key, Value>, key: Key): boolean;
138
- export declare function FSharpMap__Remove<Key, Value>(m: FSharpMap<Key, Value>, key: Key): FSharpMap<Key, Value>;
137
+ export declare function FSharpMap__ContainsKey<Key, Value>(m: FSharpMap<Key, Value>, key: Nullable<Key>): boolean;
138
+ export declare function FSharpMap__Remove<Key, Value>(m: FSharpMap<Key, Value>, key: Nullable<Key>): FSharpMap<Key, Value>;
139
139
  export declare function FSharpMap__TryGetValue<Key, Value>(_: FSharpMap<Key, Value>, key: Key, value: FSharpRef<Value>): boolean;
140
140
  export declare function FSharpMap__get_Keys<Key, Value>(_: FSharpMap<Key, Value>): Iterable<Key>;
141
141
  export declare function FSharpMap__get_Values<Key, Value>(_: FSharpMap<Key, Value>): Iterable<Value>;
@@ -150,8 +150,8 @@ export declare function add<$a, $b>(key: $a, value: $b, table: FSharpMap<$a, $b>
150
150
  export declare function change<$a, $b>(key: $a, f: ((arg0: Option<$b>) => Option<$b>), table: FSharpMap<$a, $b>): FSharpMap<$a, $b>;
151
151
  export declare function find<$a, $b>(key: $a, table: FSharpMap<$a, $b>): $b;
152
152
  export declare function tryFind<$a, $b>(key: $a, table: FSharpMap<$a, $b>): Option<$b>;
153
- export declare function remove<$a, $b>(key: $a, table: FSharpMap<$a, $b>): FSharpMap<$a, $b>;
154
- export declare function containsKey<$a, $b>(key: $a, table: FSharpMap<$a, $b>): boolean;
153
+ export declare function remove<$a, $b>(key: Nullable<$a>, table: FSharpMap<$a, $b>): FSharpMap<$a, $b>;
154
+ export declare function containsKey<$a, $b>(key: Nullable<$a>, table: FSharpMap<$a, $b>): boolean;
155
155
  export declare function iterate<$a, $b>(action: ((arg0: $a, arg1: $b) => void), table: FSharpMap<$a, $b>): void;
156
156
  export declare function tryPick<$a, $b, $c>(chooser: ((arg0: $a, arg1: $b) => Option<$c>), table: FSharpMap<$a, $b>): Option<$c>;
157
157
  export declare function pick<$a, $b, $c>(chooser: ((arg0: $a, arg1: $b) => Option<$c>), table: FSharpMap<$a, $b>): $c;
package/Map.js CHANGED
@@ -1015,13 +1015,13 @@ export class FSharpMap {
1015
1015
  const this$ = this;
1016
1016
  return FSharpMap__ComputeHashCode(this$) | 0;
1017
1017
  }
1018
- Equals(that) {
1018
+ Equals(other) {
1019
1019
  const this$ = this;
1020
- if (that instanceof FSharpMap) {
1021
- const that_1 = that;
1020
+ if (other instanceof FSharpMap) {
1021
+ const that = other;
1022
1022
  const e1 = getEnumerator(this$);
1023
1023
  try {
1024
- const e2 = getEnumerator(that_1);
1024
+ const e2 = getEnumerator(that);
1025
1025
  try {
1026
1026
  const loop = () => {
1027
1027
  const m1 = e1["System.Collections.IEnumerator.MoveNext"]();
@@ -1080,18 +1080,13 @@ export class FSharpMap {
1080
1080
  const _ = this;
1081
1081
  return MapTreeModule_mkIEnumerator(_.tree);
1082
1082
  }
1083
- CompareTo(obj) {
1084
- const m = this;
1085
- if (obj instanceof FSharpMap) {
1086
- const m2 = obj;
1087
- return compareWith((kvp1, kvp2) => {
1088
- const c = m.comparer.Compare(kvp1[0], kvp2[0]) | 0;
1089
- return ((c !== 0) ? c : compare(kvp1[1], kvp2[1])) | 0;
1090
- }, m, m2) | 0;
1091
- }
1092
- else {
1093
- throw new Error("not comparable\\nParameter name: obj");
1094
- }
1083
+ CompareTo(other) {
1084
+ let that;
1085
+ const this$ = this;
1086
+ return ((other instanceof FSharpMap) ? ((that = other, compareWith((kvp1, kvp2) => {
1087
+ const c = this$.comparer.Compare(kvp1[0], kvp2[0]) | 0;
1088
+ return ((c !== 0) ? c : compare(kvp1[1], kvp2[1])) | 0;
1089
+ }, this$, that))) : 1) | 0;
1095
1090
  }
1096
1091
  "System.Collections.Generic.ICollection`1.Add2B595"(x) {
1097
1092
  throw new Error("Map cannot be mutated");
package/Native.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ import { Nullable } from "./Util.js";
1
2
  import { int32 } from "./Int32.js";
2
- export declare function Helpers_allocateArrayFromCons<T>(cons: any, len: int32): T[];
3
+ export declare function Helpers_allocateArrayFromCons<T>(cons: Nullable<any>, len: int32): T[];
package/Native.js CHANGED
@@ -1,8 +1,14 @@
1
1
  export function Helpers_allocateArrayFromCons(cons, len) {
2
- if ((typeof cons) === "function") {
3
- return new cons(len);
2
+ if (cons == null) {
3
+ return new Array(len);
4
4
  }
5
5
  else {
6
- return new Array(len);
6
+ const cons_1 = cons;
7
+ if ((typeof cons_1) === "function") {
8
+ return new cons_1(len);
9
+ }
10
+ else {
11
+ return new Array(len);
12
+ }
7
13
  }
8
14
  }
package/Option.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type Nullable<T> = T | null | undefined;
1
+ import { Nullable } from "./Util.js";
2
2
  export type Option<T> = T | Some<T> | undefined;
3
3
  export declare class Some<T> {
4
4
  value: T;
@@ -9,6 +9,7 @@ export declare class Some<T> {
9
9
  Equals(other: Option<T>): boolean;
10
10
  CompareTo(other: Option<T>): number;
11
11
  }
12
+ export declare function nonNullValue<T>(x: Nullable<T>): T;
12
13
  export declare function value<T>(x: Option<T>): T;
13
14
  export declare function unwrap<T>(opt: Option<T>): T | undefined;
14
15
  export declare function some<T>(x: T): Option<T>;
package/Option.js CHANGED
@@ -31,6 +31,14 @@ export class Some {
31
31
  }
32
32
  }
33
33
  }
34
+ export function nonNullValue(x) {
35
+ if (x == null) {
36
+ throw new Error("Nullable has no value");
37
+ }
38
+ else {
39
+ return x;
40
+ }
41
+ }
34
42
  export function value(x) {
35
43
  if (x == null) {
36
44
  throw new Error("Option has no value");
package/Random.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { Operators_IsNull } from "./FSharp.Core.js";
1
2
  import { class_type } from "./Reflection.js";
2
3
  import { fromFloat64, op_Addition, toInt32_unchecked, toFloat64, compare, fromInt32, toInt64_unchecked } from "./BigInt.js";
3
- import { Operators_IsNull } from "./FSharp.Core.js";
4
4
  import { item, fill, setItem } from "./Array.js";
5
5
  function Native_random() {
6
6
  return Math.random();
package/Seq.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IComparer, IEqualityComparer, IDisposable, IEnumerator } from "./Util.js";
1
+ import { IComparer, IEqualityComparer, Nullable, IDisposable, IEnumerator } from "./Util.js";
2
2
  import { TypeInfo } from "./Reflection.js";
3
3
  import { Option } from "./Option.js";
4
4
  import { FSharpList } from "./List.js";
@@ -29,7 +29,7 @@ export declare class Enumerator_FromFunctions$1<T> implements IEnumerator<T>, ID
29
29
  readonly current: (() => T);
30
30
  constructor(current: (() => T), next: (() => boolean), dispose: (() => void));
31
31
  "System.Collections.Generic.IEnumerator`1.get_Current"(): T;
32
- "System.Collections.IEnumerator.get_Current"(): any;
32
+ "System.Collections.IEnumerator.get_Current"(): Nullable<any>;
33
33
  "System.Collections.IEnumerator.MoveNext"(): boolean;
34
34
  "System.Collections.IEnumerator.Reset"(): void;
35
35
  Dispose(): void;
@@ -42,7 +42,6 @@ export declare function Enumerator_enumerateThenFinally<T>(f: (() => void), e: I
42
42
  export declare function Enumerator_generateWhileSome<T, U>(openf: (() => T), compute: ((arg0: T) => Option<U>), closef: ((arg0: T) => void)): IEnumerator<U>;
43
43
  export declare function Enumerator_unfold<State, T>(f: ((arg0: State) => Option<[T, State]>), state: State): IEnumerator<T>;
44
44
  export declare function indexNotFound<$a>(): $a;
45
- export declare function checkNonNull<$a>(argName: string, arg: $a): void;
46
45
  export declare function mkSeq<T>(f: (() => IEnumerator<T>)): Iterable<T>;
47
46
  export declare function ofSeq<T>(xs: Iterable<T>): IEnumerator<T>;
48
47
  export declare function delay<T>(generator: (() => Iterable<T>)): Iterable<T>;
package/Seq.js CHANGED
@@ -1,8 +1,8 @@
1
- import { clear, defaultOf, equals, isDisposable, isArrayLike, toIterator, disposeSafe, getEnumerator } from "./Util.js";
1
+ import { clear, isDisposable, isArrayLike, toIterator, disposeSafe, getEnumerator } from "./Util.js";
2
2
  import { toString } from "./Types.js";
3
3
  import { class_type } from "./Reflection.js";
4
4
  import { some, value as value_1 } from "./Option.js";
5
- import { Operators_Lock, Operators_NullArg, Operators_IsNull } from "./FSharp.Core.js";
5
+ import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.js";
6
6
  import { chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.js";
7
7
  import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.js";
8
8
  import { SR_indexOutOfBounds } from "./Global.js";
@@ -296,17 +296,11 @@ export function Enumerator_unfold(f, state) {
296
296
  export function indexNotFound() {
297
297
  throw new Error(SR_keyNotFoundAlt);
298
298
  }
299
- export function checkNonNull(argName, arg) {
300
- if (Operators_IsNull(arg)) {
301
- Operators_NullArg(argName);
302
- }
303
- }
304
299
  export function mkSeq(f) {
305
300
  return Enumerator_Seq_$ctor_673A07F2(f);
306
301
  }
307
302
  export function ofSeq(xs) {
308
- checkNonNull("source", xs);
309
- return getEnumerator(xs);
303
+ return getEnumerator(Operators_NullArgCheck("source", xs));
310
304
  }
311
305
  export function delay(generator) {
312
306
  return mkSeq(() => getEnumerator(generator()));
@@ -365,10 +359,7 @@ export function append(xs, ys) {
365
359
  return concat([xs, ys]);
366
360
  }
367
361
  export function cast(xs) {
368
- return mkSeq(() => {
369
- checkNonNull("source", xs);
370
- return Enumerator_cast(getEnumerator(xs));
371
- });
362
+ return mkSeq(() => Enumerator_cast(getEnumerator(Operators_NullArgCheck("source", xs))));
372
363
  }
373
364
  export function choose(chooser, xs) {
374
365
  return generate(() => ofSeq(xs), (e) => {
@@ -442,7 +433,7 @@ export function enumerateThenFinally(source, compensation) {
442
433
  }
443
434
  export function enumerateUsing(resource, source) {
444
435
  const compensation = () => {
445
- if (equals(resource, defaultOf())) {
436
+ if (resource == null) {
446
437
  }
447
438
  else {
448
439
  let copyOfStruct = resource;
@@ -899,8 +890,7 @@ export function map3(mapping, xs, ys, zs) {
899
890
  });
900
891
  }
901
892
  export function readOnly(xs) {
902
- checkNonNull("source", xs);
903
- return map((x) => x, xs);
893
+ return map((x) => x, Operators_NullArgCheck("source", xs));
904
894
  }
905
895
  export class CachedSeq$1 {
906
896
  constructor(cleanup, res) {
@@ -933,7 +923,7 @@ export function CachedSeq$1__Clear(_) {
933
923
  _.cleanup();
934
924
  }
935
925
  export function cache(source) {
936
- checkNonNull("source", source);
926
+ const source_1 = Operators_NullArgCheck("source", source);
937
927
  const prefix = [];
938
928
  let enumeratorR = undefined;
939
929
  return CachedSeq$1_$ctor_Z7A8347D4(() => {
@@ -971,7 +961,7 @@ export function cache(source) {
971
961
  optEnumerator_2 = value_1(enumeratorR);
972
962
  }
973
963
  else {
974
- const optEnumerator = getEnumerator(source);
964
+ const optEnumerator = getEnumerator(source_1);
975
965
  enumeratorR = some(optEnumerator);
976
966
  optEnumerator_2 = optEnumerator;
977
967
  }
package/Set.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TypeInfo } from "./Reflection.js";
2
2
  import { Option } from "./Option.js";
3
3
  import { int32 } from "./Int32.js";
4
- import { ISet, IEnumerator, IComparer } from "./Util.js";
4
+ import { ISet, IEnumerator, IComparer, Nullable } from "./Util.js";
5
5
  import { Record } from "./Types.js";
6
6
  import { FSharpList } from "./List.js";
7
7
  export declare class SetTreeLeaf$1<T> {
@@ -29,10 +29,10 @@ export declare function SetTreeModule_mk<T>(l: Option<SetTreeLeaf$1<T>>, k: T, r
29
29
  export declare function SetTreeModule_rebalance<T>(t1: Option<SetTreeLeaf$1<T>>, v: T, t2: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
30
30
  export declare function SetTreeModule_add<T>(comparer: IComparer<T>, k: T, t: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
31
31
  export declare function SetTreeModule_balance<T>(comparer: IComparer<T>, t1: Option<SetTreeLeaf$1<T>>, k: T, t2: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
32
- export declare function SetTreeModule_split<T>(comparer: IComparer<T>, pivot: T, t: Option<SetTreeLeaf$1<T>>): [Option<SetTreeLeaf$1<T>>, boolean, Option<SetTreeLeaf$1<T>>];
32
+ export declare function SetTreeModule_split<T>(comparer: IComparer<T>, pivot: Nullable<T>, t: Option<SetTreeLeaf$1<T>>): [Option<SetTreeLeaf$1<T>>, boolean, Option<SetTreeLeaf$1<T>>];
33
33
  export declare function SetTreeModule_spliceOutSuccessor<T>(t: Option<SetTreeLeaf$1<T>>): [T, Option<SetTreeLeaf$1<T>>];
34
- export declare function SetTreeModule_remove<T>(comparer: IComparer<T>, k: T, t: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
35
- export declare function SetTreeModule_mem<T>(comparer_mut: IComparer<T>, k_mut: T, t_mut: Option<SetTreeLeaf$1<T>>): boolean;
34
+ export declare function SetTreeModule_remove<T>(comparer: IComparer<T>, k: Nullable<T>, t: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
35
+ export declare function SetTreeModule_mem<T>(comparer_mut: IComparer<T>, k_mut: Nullable<T>, t_mut: Option<SetTreeLeaf$1<T>>): boolean;
36
36
  export declare function SetTreeModule_iter<T>(f_mut: ((arg0: T) => void), t_mut: Option<SetTreeLeaf$1<T>>): void;
37
37
  export declare function SetTreeModule_foldBackOpt<T, $a>(f_mut: any, t_mut: Option<SetTreeLeaf$1<T>>, x_mut: $a): $a;
38
38
  export declare function SetTreeModule_foldBack<$a, $b>(f: ((arg0: $a, arg1: $b) => $b), m: Option<SetTreeLeaf$1<$a>>, x: $b): $b;
@@ -41,7 +41,7 @@ export declare function SetTreeModule_fold<$a, $b>(f: ((arg0: $a, arg1: $b) => $
41
41
  export declare function SetTreeModule_forall<T>(f_mut: ((arg0: T) => boolean), t_mut: Option<SetTreeLeaf$1<T>>): boolean;
42
42
  export declare function SetTreeModule_exists<T>(f_mut: ((arg0: T) => boolean), t_mut: Option<SetTreeLeaf$1<T>>): boolean;
43
43
  export declare function SetTreeModule_subset<$a>(comparer: IComparer<$a>, a: Option<SetTreeLeaf$1<$a>>, b: Option<SetTreeLeaf$1<$a>>): boolean;
44
- export declare function SetTreeModule_properSubset<$a>(comparer: IComparer<$a>, a: Option<SetTreeLeaf$1<$a>>, b: Option<SetTreeLeaf$1<$a>>): boolean;
44
+ export declare function SetTreeModule_properSubset<T>(comparer: IComparer<T>, a: Option<SetTreeLeaf$1<T>>, b: Option<SetTreeLeaf$1<T>>): boolean;
45
45
  export declare function SetTreeModule_filterAux<T>(comparer_mut: IComparer<T>, f_mut: ((arg0: T) => boolean), t_mut: Option<SetTreeLeaf$1<T>>, acc_mut: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
46
46
  export declare function SetTreeModule_filter<$a>(comparer: IComparer<$a>, f: ((arg0: $a) => boolean), s: Option<SetTreeLeaf$1<$a>>): Option<SetTreeLeaf$1<$a>>;
47
47
  export declare function SetTreeModule_diffAux<T>(comparer_mut: IComparer<T>, t_mut: Option<SetTreeLeaf$1<T>>, acc_mut: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>>;
@@ -89,11 +89,11 @@ export declare class FSharpSet<T> implements ISet<T>, Iterable<T>, Iterable<T> {
89
89
  readonly comparer: IComparer<T>;
90
90
  constructor(comparer: IComparer<T>, tree: Option<SetTreeLeaf$1<T>>);
91
91
  GetHashCode(): int32;
92
- Equals(that: any): boolean;
92
+ Equals(other: Nullable<any>): boolean;
93
93
  toString(): string;
94
94
  get [Symbol.toStringTag](): string;
95
95
  toJSON(): any;
96
- CompareTo(that: any): int32;
96
+ CompareTo(other: Nullable<any>): int32;
97
97
  "System.Collections.Generic.ICollection`1.Add2B595"(x: T): void;
98
98
  "System.Collections.Generic.ICollection`1.Clear"(): void;
99
99
  "System.Collections.Generic.ICollection`1.Remove2B595"(x: T): boolean;
@@ -121,9 +121,9 @@ export declare function FSharpSet__get_Comparer<T>(set$: FSharpSet<T>): ICompare
121
121
  export declare function FSharpSet__get_Tree<T>(set$: FSharpSet<T>): Option<SetTreeLeaf$1<T>>;
122
122
  export declare function FSharpSet_Empty<T>(comparer: IComparer<T>): FSharpSet<T>;
123
123
  export declare function FSharpSet__Add<T>(s: FSharpSet<T>, value: T): FSharpSet<T>;
124
- export declare function FSharpSet__Remove<T>(s: FSharpSet<T>, value: T): FSharpSet<T>;
124
+ export declare function FSharpSet__Remove<T>(s: FSharpSet<T>, value: Nullable<T>): FSharpSet<T>;
125
125
  export declare function FSharpSet__get_Count<T>(s: FSharpSet<T>): int32;
126
- export declare function FSharpSet__Contains<T>(s: FSharpSet<T>, value: T): boolean;
126
+ export declare function FSharpSet__Contains<T>(s: FSharpSet<T>, value: Nullable<T>): boolean;
127
127
  export declare function FSharpSet__Iterate<T>(s: FSharpSet<T>, x: ((arg0: T) => void)): void;
128
128
  export declare function FSharpSet__Fold<T, $a>(s: FSharpSet<T>, f: ((arg0: T, arg1: $a) => $a), z: $a): $a;
129
129
  export declare function FSharpSet__get_IsEmpty<T>(s: FSharpSet<T>): boolean;
@@ -149,10 +149,10 @@ export declare function FSharpSet__ToList<T>(x: FSharpSet<T>): FSharpList<T>;
149
149
  export declare function FSharpSet__ToArray<T>(x: FSharpSet<T>): T[];
150
150
  export declare function FSharpSet__ComputeHashCode<T>(this$: FSharpSet<T>): int32;
151
151
  export declare function isEmpty<T>(set$: FSharpSet<T>): boolean;
152
- export declare function contains<T>(element: T, set$: FSharpSet<T>): boolean;
152
+ export declare function contains<T>(element: Nullable<T>, set$: FSharpSet<T>): boolean;
153
153
  export declare function add<T>(value: T, set$: FSharpSet<T>): FSharpSet<T>;
154
154
  export declare function singleton<T>(value: T, comparer: IComparer<T>): FSharpSet<T>;
155
- export declare function remove<T>(value: T, set$: FSharpSet<T>): FSharpSet<T>;
155
+ export declare function remove<T>(value: Nullable<T>, set$: FSharpSet<T>): FSharpSet<T>;
156
156
  export declare function union<T>(set1: FSharpSet<T>, set2: FSharpSet<T>): FSharpSet<T>;
157
157
  export declare function unionMany<T>(sets: Iterable<FSharpSet<T>>, comparer: IComparer<T>): FSharpSet<T>;
158
158
  export declare function intersect<T>(set1: FSharpSet<T>, set2: FSharpSet<T>): FSharpSet<T>;
package/Set.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { record_type, bool_type, list_type, option_type, class_type } from "./Reflection.js";
2
2
  import { some, value as value_3 } from "./Option.js";
3
3
  import { structuralHash, toIterator, disposeSafe, getEnumerator, isArrayLike } from "./Util.js";
4
- import { toString, Record } from "./Types.js";
4
+ import { Record } from "./Types.js";
5
5
  import { fold as fold_2, cons, singleton as singleton_1, empty as empty_1, ofArrayWithTail, tail, head, isEmpty as isEmpty_1, FSharpList } from "./List.js";
6
6
  import { fold as fold_1, fill, setItem } from "./Array.js";
7
7
  import { join } from "./String.js";
@@ -1394,17 +1394,14 @@ export class FSharpSet {
1394
1394
  const this$ = this;
1395
1395
  return FSharpSet__ComputeHashCode(this$) | 0;
1396
1396
  }
1397
- Equals(that) {
1398
- let that_1;
1397
+ Equals(other) {
1398
+ let that;
1399
1399
  const this$ = this;
1400
- return (that instanceof FSharpSet) && ((that_1 = that, SetTreeModule_compare(FSharpSet__get_Comparer(this$), FSharpSet__get_Tree(this$), FSharpSet__get_Tree(that_1)) === 0));
1400
+ return (other instanceof FSharpSet) && ((that = other, SetTreeModule_compare(FSharpSet__get_Comparer(this$), FSharpSet__get_Tree(this$), FSharpSet__get_Tree(that)) === 0));
1401
1401
  }
1402
1402
  toString() {
1403
1403
  const this$ = this;
1404
- return ("set [" + join("; ", map_1((x) => {
1405
- let copyOfStruct = x;
1406
- return toString(copyOfStruct);
1407
- }, this$))) + "]";
1404
+ return ("set [" + join("; ", this$)) + "]";
1408
1405
  }
1409
1406
  get [Symbol.toStringTag]() {
1410
1407
  return "FSharpSet";
@@ -1413,9 +1410,10 @@ export class FSharpSet {
1413
1410
  const this$ = this;
1414
1411
  return Array.from(this$);
1415
1412
  }
1416
- CompareTo(that) {
1417
- const s = this;
1418
- return SetTreeModule_compare(FSharpSet__get_Comparer(s), FSharpSet__get_Tree(s), FSharpSet__get_Tree(that)) | 0;
1413
+ CompareTo(other) {
1414
+ let that;
1415
+ const this$ = this;
1416
+ return ((other instanceof FSharpSet) ? ((that = other, SetTreeModule_compare(FSharpSet__get_Comparer(this$), FSharpSet__get_Tree(this$), FSharpSet__get_Tree(that)))) : 1) | 0;
1419
1417
  }
1420
1418
  "System.Collections.Generic.ICollection`1.Add2B595"(x) {
1421
1419
  throw new Error("ReadOnlyCollection");
@@ -1,11 +1,11 @@
1
+ import { IEnumerator, IEqualityComparer, IComparer, Nullable } from "./Util.js";
1
2
  import { int32 } from "./Int32.js";
2
- import { IEnumerator, IEqualityComparer, IComparer } from "./Util.js";
3
3
  import { TypeInfo } from "./Reflection.js";
4
4
  import { FSharpRef } from "./Types.js";
5
5
  export declare class Comparer$1<T> implements IComparer<T> {
6
6
  readonly comparison: ((arg0: T, arg1: T) => int32);
7
7
  constructor(comparison: ((arg0: T, arg1: T) => int32));
8
- Compare(x: T, y: T): int32;
8
+ Compare(x: Nullable<T>, y: Nullable<T>): int32;
9
9
  }
10
10
  export declare function Comparer$1_$reflection(gen0: TypeInfo): TypeInfo;
11
11
  export declare function Comparer$1_$ctor_47C913C<T>(comparison: ((arg0: T, arg1: T) => int32)): Comparer$1<T>;
@@ -16,7 +16,7 @@ export declare class EqualityComparer$1<T> implements IEqualityComparer<T> {
16
16
  readonly getHashCode: ((arg0: T) => int32);
17
17
  readonly equals: ((arg0: T, arg1: T) => boolean);
18
18
  constructor(equals: ((arg0: T, arg1: T) => boolean), getHashCode: ((arg0: T) => int32));
19
- Equals(x: T, y: T): boolean;
19
+ Equals(x: Nullable<T>, y: Nullable<T>): boolean;
20
20
  GetHashCode(x: T): int32;
21
21
  }
22
22
  export declare function EqualityComparer$1_$reflection(gen0: TypeInfo): TypeInfo;
@@ -9,7 +9,7 @@ export class Comparer$1 {
9
9
  }
10
10
  Compare(x, y) {
11
11
  const _ = this;
12
- return _.comparison(x, y) | 0;
12
+ return ((x == null) ? ((y == null) ? 0 : -1) : ((y == null) ? 1 : _.comparison(x, y))) | 0;
13
13
  }
14
14
  }
15
15
  export function Comparer$1_$reflection(gen0) {
@@ -34,7 +34,7 @@ export class EqualityComparer$1 {
34
34
  }
35
35
  Equals(x, y) {
36
36
  const _ = this;
37
- return _.equals(x, y);
37
+ return (x == null) ? (y == null) : ((y == null) ? false : _.equals(x, y));
38
38
  }
39
39
  GetHashCode(x) {
40
40
  const _ = this;
package/System.Text.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { float64, int32 } from "./Int32.js";
2
2
  import { TypeInfo } from "./Reflection.js";
3
+ import { Nullable } from "./Util.js";
3
4
  export declare class StringBuilder {
4
5
  readonly buf: string[];
5
6
  constructor(value: string, capacity: int32);
@@ -10,8 +11,8 @@ export declare function StringBuilder_$ctor_Z18115A39(value: string, capacity: i
10
11
  export declare function StringBuilder_$ctor_Z524259A4(capacity: int32): StringBuilder;
11
12
  export declare function StringBuilder_$ctor_Z721C83C5(value: string): StringBuilder;
12
13
  export declare function StringBuilder_$ctor(): StringBuilder;
13
- export declare function StringBuilder__Append_Z721C83C5(x: StringBuilder, s: string): StringBuilder;
14
- export declare function StringBuilder__Append_487EF8FB(x: StringBuilder, s: string, startIndex: int32, count: int32): StringBuilder;
14
+ export declare function StringBuilder__Append_Z721C83C5(x: StringBuilder, s: Nullable<string>): StringBuilder;
15
+ export declare function StringBuilder__Append_487EF8FB(x: StringBuilder, s: Nullable<string>, startIndex: int32, count: int32): StringBuilder;
15
16
  export declare function StringBuilder__Append_244C7CD6(x: StringBuilder, c: string): StringBuilder;
16
17
  export declare function StringBuilder__Append_61B1CA(x: StringBuilder, c: string, repeatCount: int32): StringBuilder;
17
18
  export declare function StringBuilder__Append_Z524259A4(x: StringBuilder, o: int32): StringBuilder;
package/System.Text.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.js";
2
2
  import { class_type } from "./Reflection.js";
3
- import { clear, int32ToString } from "./Util.js";
4
3
  import { toString } from "./Types.js";
4
+ import { clear, int32ToString } from "./Util.js";
5
5
  export class StringBuilder {
6
6
  constructor(value, capacity) {
7
7
  this.buf = [];
@@ -30,11 +30,11 @@ export function StringBuilder_$ctor() {
30
30
  return StringBuilder_$ctor_Z18115A39("", 16);
31
31
  }
32
32
  export function StringBuilder__Append_Z721C83C5(x, s) {
33
- void (x.buf.push(s));
33
+ void (x.buf.push(toString(s)));
34
34
  return x;
35
35
  }
36
36
  export function StringBuilder__Append_487EF8FB(x, s, startIndex, count) {
37
- void (x.buf.push(substring(s, startIndex, count)));
37
+ void (x.buf.push(substring(toString(s), startIndex, count)));
38
38
  return x;
39
39
  }
40
40
  export function StringBuilder__Append_244C7CD6(x, c) {
@@ -67,7 +67,7 @@ export function StringBuilder__Append_Z372E4D23(x, cs) {
67
67
  return x;
68
68
  }
69
69
  export function StringBuilder__Append_43A65C09(x, s) {
70
- void (x.buf.push(toString(s)));
70
+ void (x.buf.push(s.toString()));
71
71
  return x;
72
72
  }
73
73
  export function StringBuilder__AppendFormat_433E080(x, fmt, o) {
@@ -152,7 +152,7 @@ export function StringBuilder__Replace_Z766F94C0(x, oldValue, newValue) {
152
152
  return x;
153
153
  }
154
154
  export function StringBuilder__Replace_Z384F8060(x, oldValue, newValue) {
155
- const str = replace(toString(x), oldValue, newValue);
155
+ const str = replace(x.toString(), oldValue, newValue);
156
156
  return StringBuilder__Append_Z721C83C5(StringBuilder__Clear(x), str);
157
157
  }
158
158
  export function StringBuilder__get_Length(x) {
@@ -163,5 +163,5 @@ export function StringBuilder__get_Length(x) {
163
163
  return len | 0;
164
164
  }
165
165
  export function StringBuilder__ToString_Z37302880(x, firstIndex, length) {
166
- return substring(toString(x), firstIndex, length);
166
+ return substring(x.toString(), firstIndex, length);
167
167
  }
package/Util.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type Nullable<T> = T | null | undefined;
1
2
  export declare const enum DateKind {
2
3
  Unspecified = 0,
3
4
  UTC = 1,
@@ -22,10 +23,10 @@ export interface IDisposable {
22
23
  Dispose(): void;
23
24
  }
24
25
  export interface IComparer<T> {
25
- Compare(x: T, y: T): number;
26
+ Compare(x: Nullable<T>, y: Nullable<T>): number;
26
27
  }
27
28
  export interface IEqualityComparer<T> {
28
- Equals(x: T, y: T): boolean;
29
+ Equals(x: Nullable<T>, y: Nullable<T>): boolean;
29
30
  GetHashCode(x: T): number;
30
31
  }
31
32
  export interface ICollection<T> extends Iterable<T> {
@@ -147,9 +148,10 @@ export declare function arrayHash<T>(x: ArrayLike<T>): number;
147
148
  export declare function structuralHash<T>(x: T): number;
148
149
  export declare function fastStructuralHash<T>(x: T): number;
149
150
  export declare function safeHash<T>(x: T): number;
150
- export declare function equalArraysWith<T>(x: ArrayLike<T>, y: ArrayLike<T>, eq: (x: T, y: T) => boolean): boolean;
151
- export declare function equalArrays<T>(x: ArrayLike<T>, y: ArrayLike<T>): boolean;
152
- export declare function physicalEquality<T>(x: T, y: T): boolean;
151
+ export declare function equalArraysWith<T>(x: Nullable<ArrayLike<T>>, y: Nullable<ArrayLike<T>>, eq: (x: T, y: T) => boolean): boolean;
152
+ export declare function equalArrays<T>(x: Nullable<ArrayLike<T>>, y: Nullable<ArrayLike<T>>): boolean;
153
+ export declare function physicalEquals<T>(x: T, y: T): boolean;
154
+ export declare function nullableEquals<T>(x: Nullable<T>, y: Nullable<T>): boolean;
153
155
  export declare function equals<T>(x: T, y: T): boolean;
154
156
  export declare function compareDates(x: Date | IDateTime | IDateTimeOffset, y: Date | IDateTime | IDateTimeOffset): 0 | 1 | -1;
155
157
  export declare function comparePrimitives<T>(x: T, y: T): number;
package/Util.js CHANGED
@@ -333,9 +333,18 @@ function equalObjects(x, y) {
333
333
  }
334
334
  return true;
335
335
  }
336
- export function physicalEquality(x, y) {
336
+ export function physicalEquals(x, y) {
337
337
  return x === y;
338
338
  }
339
+ export function nullableEquals(x, y) {
340
+ if (x == null) {
341
+ return y == null;
342
+ }
343
+ if (y == null) {
344
+ return false;
345
+ }
346
+ return equals(x, y);
347
+ }
339
348
  export function equals(x, y) {
340
349
  if (x === y) {
341
350
  return true;
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
- "sideEffects": false,
3
- "private": false,
4
- "type": "module",
5
- "name": "@fable-org/fable-library-js",
6
- "version": "2.0.0-beta.3",
7
- "description": "Core library used by F# projects compiled with fable.io",
8
- "author": "Fable Contributors",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/fable-compiler/Fable.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/fable-compiler/Fable/issues"
16
- },
17
- "homepage": "https://fable.io",
18
- "keywords": [
19
- "fable",
20
- "fable-compiler",
21
- "fsharp",
22
- "F#"
23
- ]
24
- }
2
+ "sideEffects": false,
3
+ "private": false,
4
+ "type": "module",
5
+ "name": "@fable-org/fable-library-js",
6
+ "version": "2.0.0-beta.4",
7
+ "description": "Core library used by F# projects compiled with fable.io",
8
+ "author": "Fable Contributors",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/fable-compiler/Fable.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/fable-compiler/Fable/issues"
16
+ },
17
+ "homepage": "https://fable.io",
18
+ "keywords": [
19
+ "fable",
20
+ "fable-compiler",
21
+ "fsharp",
22
+ "F#"
23
+ ]
24
+ }