@fable-org/fable-library-ts 2.0.0-beta.4 → 2.0.0-beta.5

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 (55) hide show
  1. package/Array.ts +253 -247
  2. package/Async.ts +13 -12
  3. package/AsyncBuilder.ts +10 -11
  4. package/BigInt.ts +6 -6
  5. package/BitConverter.ts +3 -3
  6. package/Boolean.ts +3 -2
  7. package/CHANGELOG.md +8 -0
  8. package/Char.ts +38 -35
  9. package/Choice.ts +36 -12
  10. package/CollectionUtil.ts +4 -4
  11. package/Date.ts +67 -62
  12. package/DateOffset.ts +48 -57
  13. package/DateOnly.ts +8 -8
  14. package/Decimal.ts +9 -9
  15. package/Double.ts +3 -2
  16. package/Encoding.ts +1 -1
  17. package/Event.ts +3 -3
  18. package/FSharp.Collections.ts +31 -13
  19. package/FSharp.Core.CompilerServices.ts +4 -4
  20. package/FSharp.Core.ts +34 -34
  21. package/Global.ts +44 -2
  22. package/Guid.ts +7 -6
  23. package/Int32.ts +20 -17
  24. package/List.ts +57 -56
  25. package/Long.ts +6 -5
  26. package/MailboxProcessor.ts +8 -7
  27. package/Map.ts +67 -65
  28. package/MapUtil.ts +5 -5
  29. package/MutableMap.ts +32 -20
  30. package/MutableSet.ts +12 -12
  31. package/Native.ts +3 -3
  32. package/Numeric.ts +1 -1
  33. package/Observable.ts +3 -3
  34. package/Option.ts +3 -3
  35. package/Random.ts +34 -34
  36. package/Range.ts +7 -7
  37. package/Reflection.ts +73 -40
  38. package/RegExp.ts +5 -3
  39. package/Result.ts +31 -27
  40. package/Seq.ts +56 -54
  41. package/Seq2.ts +14 -14
  42. package/Set.ts +81 -80
  43. package/String.ts +41 -38
  44. package/System.Collections.Generic.ts +45 -25
  45. package/System.Text.ts +12 -12
  46. package/System.ts +366 -0
  47. package/TimeOnly.ts +10 -10
  48. package/TimeSpan.ts +11 -11
  49. package/Timer.ts +2 -2
  50. package/Types.ts +1 -19
  51. package/Uri.ts +13 -10
  52. package/Util.ts +74 -26
  53. package/package.json +1 -1
  54. package/tsconfig.json +18 -5
  55. package/SystemException.ts +0 -7
package/Map.ts CHANGED
@@ -1,13 +1,15 @@
1
1
 
2
- import { record_type, bool_type, list_type, option_type, class_type, TypeInfo } from "./Reflection.js";
3
- import { some, value as value_1, Option } from "./Option.js";
4
- import { int32 } from "./Int32.js";
5
- import { structuralHash, IMap, compare, toIterator, equals, IDisposable, disposeSafe, getEnumerator, isArrayLike, IEnumerator, IComparer, Nullable } from "./Util.js";
6
- import { singleton, ofArrayWithTail, head, tail, isEmpty as isEmpty_1, fold as fold_1, empty as empty_1, FSharpList, cons } from "./List.js";
7
- import { map as map_2, item, fill, setItem } from "./Array.js";
8
- import { FSharpRef, Record } from "./Types.js";
9
- import { tryPick as tryPick_1, pick as pick_1, iterate as iterate_1, compareWith, map as map_1, unfold } from "./Seq.js";
10
- import { format, join } from "./String.js";
2
+ import { record_type, bool_type, list_type, option_type, class_type, TypeInfo } from "./Reflection.ts";
3
+ import { some, value as value_1, Option } from "./Option.ts";
4
+ import { int32 } from "./Int32.ts";
5
+ import { structuralHash, IMap, compare, toIterator, equals, IDisposable, disposeSafe, getEnumerator, isArrayLike, IEnumerator, MutableArray, IComparer, Exception } from "./Util.ts";
6
+ import { KeyNotFoundException_$ctor } from "./System.Collections.Generic.ts";
7
+ import { singleton, ofArrayWithTail, head, tail, isEmpty as isEmpty_1, fold as fold_1, empty as empty_1, FSharpList, cons } from "./List.ts";
8
+ import { map as map_2, item, fill, setItem } from "./Array.ts";
9
+ import { FSharpRef, Record } from "./Types.ts";
10
+ import { tryPick as tryPick_1, pick as pick_1, iterate as iterate_1, compareWith, map as map_1, unfold } from "./Seq.ts";
11
+ import { format, join } from "./String.ts";
12
+ import { NotSupportedException_$ctor_Z721C83C5 } from "./System.ts";
11
13
 
12
14
  export class MapTreeLeaf$2<Key, Value> {
13
15
  readonly v: Value;
@@ -98,7 +100,7 @@ export function MapTreeModule_size<$a, $b>(x: Option<MapTreeLeaf$2<$a, $b>>): in
98
100
  }
99
101
 
100
102
  export function MapTreeModule_mk<Key, Value>(l: Option<MapTreeLeaf$2<Key, Value>>, k: Key, v: Value, r: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>> {
101
- let mn: MapTreeNode$2<Key, Value>, mn_1: MapTreeNode$2<Key, Value>;
103
+ let mn: MapTreeNode$2<Key, Value> = (undefined as any), mn_1: MapTreeNode$2<Key, Value> = (undefined as any);
102
104
  let hl: int32;
103
105
  const m: Option<MapTreeLeaf$2<Key, Value>> = l;
104
106
  if (m != null) {
@@ -127,7 +129,7 @@ export function MapTreeModule_mk<Key, Value>(l: Option<MapTreeLeaf$2<Key, Value>
127
129
  }
128
130
 
129
131
  export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key, Value>>, k: Key, v: Value, t2: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>> {
130
- let mn: MapTreeNode$2<Key, Value>, mn_1: MapTreeNode$2<Key, Value>, m_2: Option<MapTreeLeaf$2<Key, Value>>, m2_2: MapTreeLeaf$2<Key, Value>, mn_2: MapTreeNode$2<Key, Value>, m_3: Option<MapTreeLeaf$2<Key, Value>>, m2_3: MapTreeLeaf$2<Key, Value>, mn_3: MapTreeNode$2<Key, Value>;
132
+ let mn: MapTreeNode$2<Key, Value> = (undefined as any), mn_1: MapTreeNode$2<Key, Value> = (undefined as any), m_2: Option<MapTreeLeaf$2<Key, Value>> = (undefined as any), m2_2: MapTreeLeaf$2<Key, Value> = (undefined as any), mn_2: MapTreeNode$2<Key, Value> = (undefined as any), m_3: Option<MapTreeLeaf$2<Key, Value>> = (undefined as any), m2_3: MapTreeLeaf$2<Key, Value> = (undefined as any), mn_3: MapTreeNode$2<Key, Value> = (undefined as any);
131
133
  let t1h: int32;
132
134
  const m: Option<MapTreeLeaf$2<Key, Value>> = t1;
133
135
  if (m != null) {
@@ -157,7 +159,7 @@ export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key
157
159
  return MapTreeModule_mk<Key, Value>(MapTreeModule_mk<Key, Value>(t1, k, v, MapTreeNode$2__get_Left<Key, Value>(t2l)), MapTreeLeaf$2__get_Key<Key, Value>(t2l), MapTreeLeaf$2__get_Value<Key, Value>(t2l), MapTreeModule_mk<Key, Value>(MapTreeNode$2__get_Right<Key, Value>(t2l), MapTreeLeaf$2__get_Key<Key, Value>(t2$0027), MapTreeLeaf$2__get_Value<Key, Value>(t2$0027), MapTreeNode$2__get_Right<Key, Value>(t2$0027)));
158
160
  }
159
161
  else {
160
- throw new Error("internal error: Map.rebalance");
162
+ throw new Exception("internal error: Map.rebalance");
161
163
  }
162
164
  }
163
165
  else {
@@ -165,7 +167,7 @@ export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key
165
167
  }
166
168
  }
167
169
  else {
168
- throw new Error("internal error: Map.rebalance");
170
+ throw new Exception("internal error: Map.rebalance");
169
171
  }
170
172
  }
171
173
  else if (t1h > (t2h + 2)) {
@@ -179,7 +181,7 @@ export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key
179
181
  return MapTreeModule_mk<Key, Value>(MapTreeModule_mk<Key, Value>(MapTreeNode$2__get_Left<Key, Value>(t1$0027), MapTreeLeaf$2__get_Key<Key, Value>(t1$0027), MapTreeLeaf$2__get_Value<Key, Value>(t1$0027), MapTreeNode$2__get_Left<Key, Value>(t1r)), MapTreeLeaf$2__get_Key<Key, Value>(t1r), MapTreeLeaf$2__get_Value<Key, Value>(t1r), MapTreeModule_mk<Key, Value>(MapTreeNode$2__get_Right<Key, Value>(t1r), k, v, t2));
180
182
  }
181
183
  else {
182
- throw new Error("internal error: Map.rebalance");
184
+ throw new Exception("internal error: Map.rebalance");
183
185
  }
184
186
  }
185
187
  else {
@@ -187,7 +189,7 @@ export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key
187
189
  }
188
190
  }
189
191
  else {
190
- throw new Error("internal error: Map.rebalance");
192
+ throw new Exception("internal error: Map.rebalance");
191
193
  }
192
194
  }
193
195
  else {
@@ -198,7 +200,7 @@ export function MapTreeModule_rebalance<Key, Value>(t1: Option<MapTreeLeaf$2<Key
198
200
  export function MapTreeModule_add<Key, Value>(comparer: IComparer<Key>, k: Key, v: Value, m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>> {
199
201
  if (m != null) {
200
202
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
201
- const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) | 0;
203
+ const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(m2)) | 0;
202
204
  if (m2 instanceof MapTreeNode$2) {
203
205
  const mn = m2 as MapTreeNode$2<Key, Value>;
204
206
  if (c < 0) {
@@ -232,7 +234,7 @@ export function MapTreeModule_tryFind<Key, Value>(comparer_mut: IComparer<Key>,
232
234
  const comparer: IComparer<Key> = comparer_mut, k: Key = k_mut, m: Option<MapTreeLeaf$2<Key, Value>> = m_mut;
233
235
  if (m != null) {
234
236
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
235
- const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) | 0;
237
+ const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(m2)) | 0;
236
238
  if (c === 0) {
237
239
  return some(MapTreeLeaf$2__get_Value<Key, Value>(m2));
238
240
  }
@@ -257,7 +259,7 @@ export function MapTreeModule_tryFind<Key, Value>(comparer_mut: IComparer<Key>,
257
259
  export function MapTreeModule_find<Key, Value>(comparer: IComparer<Key>, k: Key, m: Option<MapTreeLeaf$2<Key, Value>>): Value {
258
260
  const matchValue: Option<Value> = MapTreeModule_tryFind<Key, Value>(comparer, k, m);
259
261
  if (matchValue == null) {
260
- throw new Error();
262
+ throw KeyNotFoundException_$ctor();
261
263
  }
262
264
  else {
263
265
  return value_1(matchValue);
@@ -364,14 +366,14 @@ export function MapTreeModule_spliceOutSuccessor<Key, Value>(m: Option<MapTreeLe
364
366
  }
365
367
  }
366
368
  else {
367
- throw new Error("internal error: Map.spliceOutSuccessor");
369
+ throw new Exception("internal error: Map.spliceOutSuccessor");
368
370
  }
369
371
  }
370
372
 
371
- export function MapTreeModule_remove<Key, Value>(comparer: IComparer<Key>, k: Nullable<Key>, m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>> {
373
+ export function MapTreeModule_remove<Key, Value>(comparer: IComparer<Key>, k: Key, m: Option<MapTreeLeaf$2<Key, Value>>): Option<MapTreeLeaf$2<Key, Value>> {
372
374
  if (m != null) {
373
375
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
374
- const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) | 0;
376
+ const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(m2)) | 0;
375
377
  if (m2 instanceof MapTreeNode$2) {
376
378
  const mn = m2 as MapTreeNode$2<Key, Value>;
377
379
  if (c < 0) {
@@ -410,7 +412,7 @@ export function MapTreeModule_change<Key, Value>(comparer: IComparer<Key>, k: Ke
410
412
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
411
413
  if (m2 instanceof MapTreeNode$2) {
412
414
  const mn = m2 as MapTreeNode$2<Key, Value>;
413
- const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(mn)) | 0;
415
+ const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(mn)) | 0;
414
416
  if (c < 0) {
415
417
  return MapTreeModule_rebalance<Key, Value>(MapTreeModule_change<Key, Value>(comparer, k, u, MapTreeNode$2__get_Left<Key, Value>(mn)), MapTreeLeaf$2__get_Key<Key, Value>(mn), MapTreeLeaf$2__get_Value<Key, Value>(mn), MapTreeNode$2__get_Right<Key, Value>(mn));
416
418
  }
@@ -435,7 +437,7 @@ export function MapTreeModule_change<Key, Value>(comparer: IComparer<Key>, k: Ke
435
437
  }
436
438
  }
437
439
  else {
438
- const c_1: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) | 0;
440
+ const c_1: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(m2)) | 0;
439
441
  if (c_1 < 0) {
440
442
  const matchValue_2: Option<Value> = u(undefined);
441
443
  if (matchValue_2 != null) {
@@ -476,13 +478,13 @@ export function MapTreeModule_change<Key, Value>(comparer: IComparer<Key>, k: Ke
476
478
  }
477
479
  }
478
480
 
479
- export function MapTreeModule_mem<Key, Value>(comparer_mut: IComparer<Key>, k_mut: Nullable<Key>, m_mut: Option<MapTreeLeaf$2<Key, Value>>): boolean {
481
+ export function MapTreeModule_mem<Key, Value>(comparer_mut: IComparer<Key>, k_mut: Key, m_mut: Option<MapTreeLeaf$2<Key, Value>>): boolean {
480
482
  MapTreeModule_mem:
481
483
  while (true) {
482
- const comparer: IComparer<Key> = comparer_mut, k: Nullable<Key> = k_mut, m: Option<MapTreeLeaf$2<Key, Value>> = m_mut;
484
+ const comparer: IComparer<Key> = comparer_mut, k: Key = k_mut, m: Option<MapTreeLeaf$2<Key, Value>> = m_mut;
483
485
  if (m != null) {
484
486
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
485
- const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) | 0;
487
+ const c: int32 = comparer.Compare(k, MapTreeLeaf$2__get_Key<Key, Value>(m2)) | 0;
486
488
  if (m2 instanceof MapTreeNode$2) {
487
489
  const mn = m2 as MapTreeNode$2<Key, Value>;
488
490
  if (c < 0) {
@@ -741,7 +743,7 @@ export function MapTreeModule_fold<$a, $b, $c>(f: ((arg0: $a, arg1: $b, arg2: $c
741
743
  return MapTreeModule_foldOpt<$a, $b, $c>(f, x, m);
742
744
  }
743
745
 
744
- export 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 {
746
+ export function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<Key>, lo: Key, hi: Key, f: any, m: Option<MapTreeLeaf$2<Key, Value>>, x: a): a {
745
747
  const foldFromTo = (f_1_mut: any, m_1_mut: Option<MapTreeLeaf$2<Key, Value>>, x_1_mut: a): a => {
746
748
  foldFromTo:
747
749
  while (true) {
@@ -750,8 +752,8 @@ export function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<
750
752
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m_1);
751
753
  if (m2 instanceof MapTreeNode$2) {
752
754
  const mn = m2 as MapTreeNode$2<Key, Value>;
753
- const cLoKey: int32 = comparer.Compare(lo, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(mn)) | 0;
754
- const cKeyHi: int32 = comparer.Compare(MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(mn), hi) | 0;
755
+ const cLoKey: int32 = comparer.Compare(lo, MapTreeLeaf$2__get_Key<Key, Value>(mn)) | 0;
756
+ const cKeyHi: int32 = comparer.Compare(MapTreeLeaf$2__get_Key<Key, Value>(mn), hi) | 0;
755
757
  const x_2: a = (cLoKey < 0) ? foldFromTo(f_1, MapTreeNode$2__get_Left<Key, Value>(mn), x_1) : x_1;
756
758
  const x_3: a = ((cLoKey <= 0) && (cKeyHi <= 0)) ? f_1(MapTreeLeaf$2__get_Key<Key, Value>(mn), MapTreeLeaf$2__get_Value<Key, Value>(mn), x_2) : x_2;
757
759
  if (cKeyHi < 0) {
@@ -764,7 +766,7 @@ export function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<
764
766
  return x_3;
765
767
  }
766
768
  }
767
- else if ((comparer.Compare(lo, MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2)) <= 0) && (comparer.Compare(MapTreeLeaf$2__get_Key<Nullable<Key>, Value>(m2), hi) <= 0)) {
769
+ else if ((comparer.Compare(lo, MapTreeLeaf$2__get_Key<Key, Value>(m2)) <= 0) && (comparer.Compare(MapTreeLeaf$2__get_Key<Key, Value>(m2), hi) <= 0)) {
768
770
  return f_1(MapTreeLeaf$2__get_Key<Key, Value>(m2), MapTreeLeaf$2__get_Value<Key, Value>(m2), x_1);
769
771
  }
770
772
  else {
@@ -785,7 +787,7 @@ export function MapTreeModule_foldSectionOpt<Key, Value, a>(comparer: IComparer<
785
787
  }
786
788
  }
787
789
 
788
- export 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 {
790
+ export function MapTreeModule_foldSection<$a, $b, $c>(comparer: IComparer<$a>, lo: $a, hi: $a, f: ((arg0: $a, arg1: $b, arg2: $c) => $c), m: Option<MapTreeLeaf$2<$a, $b>>, x: $c): $c {
789
791
  return MapTreeModule_foldSectionOpt<$a, $b, $c>(comparer, lo, hi, f, m, x);
790
792
  }
791
793
 
@@ -815,7 +817,7 @@ export function MapTreeModule_toList<Key, Value>(m: Option<MapTreeLeaf$2<Key, Va
815
817
  return loop(m, empty_1<[Key, Value]>());
816
818
  }
817
819
 
818
- export function MapTreeModule_copyToArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>, arr: [$a, $b][], i: int32): void {
820
+ export function MapTreeModule_copyToArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>, arr: MutableArray<[$a, $b]>, i: int32): void {
819
821
  let j: int32 = i;
820
822
  MapTreeModule_iter<$a, $b>((x: $a, y: $b): void => {
821
823
  setItem(arr, j, [x, y] as [$a, $b]);
@@ -823,9 +825,9 @@ export function MapTreeModule_copyToArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b
823
825
  }, m);
824
826
  }
825
827
 
826
- export function MapTreeModule_toArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>): [$a, $b][] {
828
+ export function MapTreeModule_toArray<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>>): MutableArray<[$a, $b]> {
827
829
  const n: int32 = MapTreeModule_size<$a, $b>(m) | 0;
828
- const res: [$a, $b][] = fill(new Array(n), 0, n, [null, null] as [any, any]);
830
+ const res: MutableArray<[$a, $b]> = fill(new Array(n), 0, n, [null, null] as [any, any]);
829
831
  MapTreeModule_copyToArray<$a, $b>(m, res, 0);
830
832
  return res;
831
833
  }
@@ -852,7 +854,7 @@ export function MapTreeModule_mkFromEnumerator<$a, $b>(comparer_mut: IComparer<$
852
854
  }
853
855
  }
854
856
 
855
- export function MapTreeModule_ofArray<Key, Value>(comparer: IComparer<Key>, arr: [Key, Value][]): Option<MapTreeLeaf$2<Key, Value>> {
857
+ export function MapTreeModule_ofArray<Key, Value>(comparer: IComparer<Key>, arr: MutableArray<[Key, Value]>): Option<MapTreeLeaf$2<Key, Value>> {
856
858
  let res: Option<MapTreeLeaf$2<Key, Value>> = MapTreeModule_empty<Key, Value>();
857
859
  for (let idx = 0; idx <= (arr.length - 1); idx++) {
858
860
  const forLoopVar: [Key, Value] = item(idx, arr);
@@ -928,11 +930,11 @@ export function MapTreeModule_mkIterator<$a, $b>(m: Option<MapTreeLeaf$2<$a, $b>
928
930
  }
929
931
 
930
932
  export function MapTreeModule_notStarted<$a>(): $a {
931
- throw new Error("enumeration not started");
933
+ throw new Exception("enumeration not started");
932
934
  }
933
935
 
934
936
  export function MapTreeModule_alreadyFinished<$a>(): $a {
935
- throw new Error("enumeration already finished");
937
+ throw new Exception("enumeration already finished");
936
938
  }
937
939
 
938
940
  export function MapTreeModule_current<Key, Value>(i: MapTreeModule_MapIterator$2<Key, Value>): [Key, Value] {
@@ -942,14 +944,14 @@ export function MapTreeModule_current<Key, Value>(i: MapTreeModule_MapIterator$2
942
944
  if (head(matchValue) != null) {
943
945
  const m: MapTreeLeaf$2<Key, Value> = value_1(head(matchValue));
944
946
  if (m instanceof MapTreeNode$2) {
945
- throw new Error("Please report error: Map iterator, unexpected stack for current");
947
+ throw new Exception("Please report error: Map iterator, unexpected stack for current");
946
948
  }
947
949
  else {
948
950
  return [MapTreeLeaf$2__get_Key<Key, Value>(m), MapTreeLeaf$2__get_Value<Key, Value>(m)] as [Key, Value];
949
951
  }
950
952
  }
951
953
  else {
952
- throw new Error("Please report error: Map iterator, unexpected stack for current");
954
+ throw new Exception("Please report error: Map iterator, unexpected stack for current");
953
955
  }
954
956
  }
955
957
  else {
@@ -968,7 +970,7 @@ export function MapTreeModule_moveNext<Key, Value>(i: MapTreeModule_MapIterator$
968
970
  if (head(matchValue) != null) {
969
971
  const m: MapTreeLeaf$2<Key, Value> = value_1(head(matchValue));
970
972
  if (m instanceof MapTreeNode$2) {
971
- throw new Error("Please report error: Map iterator, unexpected stack for moveNext");
973
+ throw new Exception("Please report error: Map iterator, unexpected stack for moveNext");
972
974
  }
973
975
  else {
974
976
  i.stack = MapTreeModule_collapseLHS<Key, Value>(tail(matchValue));
@@ -976,7 +978,7 @@ export function MapTreeModule_moveNext<Key, Value>(i: MapTreeModule_MapIterator$
976
978
  }
977
979
  }
978
980
  else {
979
- throw new Error("Please report error: Map iterator, unexpected stack for moveNext");
981
+ throw new Exception("Please report error: Map iterator, unexpected stack for moveNext");
980
982
  }
981
983
  }
982
984
  else {
@@ -995,7 +997,7 @@ export function MapTreeModule_mkIEnumerator<a, b>(m: Option<MapTreeLeaf$2<a, b>>
995
997
  "System.Collections.Generic.IEnumerator`1.get_Current"(): [a, b] {
996
998
  return MapTreeModule_current<a, b>(i);
997
999
  },
998
- "System.Collections.IEnumerator.get_Current"(): Nullable<any> {
1000
+ "System.Collections.IEnumerator.get_Current"(): any {
999
1001
  return MapTreeModule_current<a, b>(i);
1000
1002
  },
1001
1003
  "System.Collections.IEnumerator.MoveNext"(): boolean {
@@ -1026,7 +1028,7 @@ export function MapTreeModule_leftmost<Key, Value>(m_mut: Option<MapTreeLeaf$2<K
1026
1028
  const m: Option<MapTreeLeaf$2<Key, Value>> = m_mut;
1027
1029
  if (m != null) {
1028
1030
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
1029
- let matchResult: int32, nd_1: MapTreeNode$2<Key, Value>;
1031
+ let matchResult: int32 = (undefined as any), nd_1: MapTreeNode$2<Key, Value> = (undefined as any);
1030
1032
  if (m2 instanceof MapTreeNode$2) {
1031
1033
  if (MapTreeNode$2__get_Height<Key, Value>(m2 as MapTreeNode$2<Key, Value>) > 1) {
1032
1034
  matchResult = 0;
@@ -1053,7 +1055,7 @@ export function MapTreeModule_leftmost<Key, Value>(m_mut: Option<MapTreeLeaf$2<K
1053
1055
  }
1054
1056
  }
1055
1057
  else {
1056
- throw new Error();
1058
+ throw KeyNotFoundException_$ctor();
1057
1059
  }
1058
1060
  break;
1059
1061
  }
@@ -1065,7 +1067,7 @@ export function MapTreeModule_rightmost<Key, Value>(m_mut: Option<MapTreeLeaf$2<
1065
1067
  const m: Option<MapTreeLeaf$2<Key, Value>> = m_mut;
1066
1068
  if (m != null) {
1067
1069
  const m2: MapTreeLeaf$2<Key, Value> = value_1(m);
1068
- let matchResult: int32, nd_1: MapTreeNode$2<Key, Value>;
1070
+ let matchResult: int32 = (undefined as any), nd_1: MapTreeNode$2<Key, Value> = (undefined as any);
1069
1071
  if (m2 instanceof MapTreeNode$2) {
1070
1072
  if (MapTreeNode$2__get_Height<Key, Value>(m2 as MapTreeNode$2<Key, Value>) > 1) {
1071
1073
  matchResult = 0;
@@ -1092,7 +1094,7 @@ export function MapTreeModule_rightmost<Key, Value>(m_mut: Option<MapTreeLeaf$2<
1092
1094
  }
1093
1095
  }
1094
1096
  else {
1095
- throw new Error();
1097
+ throw KeyNotFoundException_$ctor();
1096
1098
  }
1097
1099
  break;
1098
1100
  }
@@ -1109,7 +1111,7 @@ export class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable<[Key, V
1109
1111
  const this$: FSharpMap<Key, Value> = this;
1110
1112
  return FSharpMap__ComputeHashCode<Key, Value>(this$) | 0;
1111
1113
  }
1112
- Equals(other: Nullable<any>): boolean {
1114
+ Equals(other: any): boolean {
1113
1115
  const this$: FSharpMap<Key, Value> = this;
1114
1116
  if (other instanceof FSharpMap) {
1115
1117
  const that = other as FSharpMap<Key, Value>;
@@ -1174,8 +1176,8 @@ export class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable<[Key, V
1174
1176
  const _: FSharpMap<Key, Value> = this;
1175
1177
  return MapTreeModule_mkIEnumerator<Key, Value>(_.tree);
1176
1178
  }
1177
- CompareTo(other: Nullable<any>): int32 {
1178
- let that: FSharpMap<Key, Value>;
1179
+ CompareTo(other: any): int32 {
1180
+ let that: FSharpMap<Key, Value> = undefined as any;
1179
1181
  const this$: FSharpMap<Key, Value> = this;
1180
1182
  return ((other instanceof FSharpMap) ? ((that = (other as FSharpMap<Key, Value>), compareWith<[Key, Value]>((kvp1: [Key, Value], kvp2: [Key, Value]): int32 => {
1181
1183
  const c: int32 = this$.comparer.Compare(kvp1[0], kvp2[0]) | 0;
@@ -1183,19 +1185,19 @@ export class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable<[Key, V
1183
1185
  }, this$, that))) : 1) | 0;
1184
1186
  }
1185
1187
  "System.Collections.Generic.ICollection`1.Add2B595"(x: [Key, Value]): void {
1186
- throw new Error("Map cannot be mutated");
1188
+ throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1187
1189
  }
1188
1190
  "System.Collections.Generic.ICollection`1.Clear"(): void {
1189
- throw new Error("Map cannot be mutated");
1191
+ throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1190
1192
  }
1191
1193
  "System.Collections.Generic.ICollection`1.Remove2B595"(x: [Key, Value]): boolean {
1192
- throw new Error("Map cannot be mutated");
1194
+ throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1193
1195
  }
1194
1196
  "System.Collections.Generic.ICollection`1.Contains2B595"(x: [Key, Value]): boolean {
1195
1197
  const m: FSharpMap<Key, Value> = this;
1196
1198
  return FSharpMap__ContainsKey<Key, Value>(m, x[0]) && equals(FSharpMap__get_Item<Key, Value>(m, x[0]), x[1]);
1197
1199
  }
1198
- "System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(arr: [Key, Value][], i: int32): void {
1200
+ "System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(arr: MutableArray<[Key, Value]>, i: int32): void {
1199
1201
  const m: FSharpMap<Key, Value> = this;
1200
1202
  MapTreeModule_copyToArray<Key, Value>(m.tree, arr, i);
1201
1203
  }
@@ -1215,10 +1217,10 @@ export class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable<[Key, V
1215
1217
  return FSharpMap__get_Count<Key, Value>(m) | 0;
1216
1218
  }
1217
1219
  clear(): void {
1218
- throw new Error("Map cannot be mutated");
1220
+ throw new Exception("Map cannot be mutated");
1219
1221
  }
1220
1222
  delete(_arg: Key): boolean {
1221
- throw new Error("Map cannot be mutated");
1223
+ throw new Exception("Map cannot be mutated");
1222
1224
  return false;
1223
1225
  }
1224
1226
  entries(): Iterable<[Key, Value]> {
@@ -1239,7 +1241,7 @@ export class FSharpMap<Key, Value> implements IMap<Key, Value>, Iterable<[Key, V
1239
1241
  }
1240
1242
  set(k: Key, v: Value): IMap<Key, Value> {
1241
1243
  const m: FSharpMap<Key, Value> = this;
1242
- throw new Error("Map cannot be mutated");
1244
+ throw new Exception("Map cannot be mutated");
1243
1245
  return m;
1244
1246
  }
1245
1247
  values(): Iterable<Value> {
@@ -1310,7 +1312,7 @@ export function FSharpMap__Fold<Key, Value, $a>(m: FSharpMap<Key, Value>, f: ((a
1310
1312
  return MapTreeModule_foldBack<Key, Value, $a>(f, m.tree, acc);
1311
1313
  }
1312
1314
 
1313
- export 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 {
1315
+ export function FSharpMap__FoldSection<Key, Value, $a>(m: FSharpMap<Key, Value>, lo: Key, hi: Key, f: ((arg0: Key, arg1: Value, arg2: $a) => $a), acc: $a): $a {
1314
1316
  return MapTreeModule_foldSection<Key, Value, $a>(m.comparer, lo, hi, f, m.tree, acc);
1315
1317
  }
1316
1318
 
@@ -1335,11 +1337,11 @@ export function FSharpMap__get_Count<Key, Value>(m: FSharpMap<Key, Value>): int3
1335
1337
  return MapTreeModule_size<Key, Value>(m.tree) | 0;
1336
1338
  }
1337
1339
 
1338
- export function FSharpMap__ContainsKey<Key, Value>(m: FSharpMap<Key, Value>, key: Nullable<Key>): boolean {
1340
+ export function FSharpMap__ContainsKey<Key, Value>(m: FSharpMap<Key, Value>, key: Key): boolean {
1339
1341
  return MapTreeModule_mem<Key, Value>(m.comparer, key, m.tree);
1340
1342
  }
1341
1343
 
1342
- export function FSharpMap__Remove<Key, Value>(m: FSharpMap<Key, Value>, key: Nullable<Key>): FSharpMap<Key, Value> {
1344
+ export function FSharpMap__Remove<Key, Value>(m: FSharpMap<Key, Value>, key: Key): FSharpMap<Key, Value> {
1343
1345
  return FSharpMap_$ctor<Key, Value>(m.comparer, MapTreeModule_remove<Key, Value>(m.comparer, key, m.tree));
1344
1346
  }
1345
1347
 
@@ -1379,7 +1381,7 @@ export function FSharpMap__ToList<Key, Value>(m: FSharpMap<Key, Value>): FSharpL
1379
1381
  return MapTreeModule_toList<Key, Value>(m.tree);
1380
1382
  }
1381
1383
 
1382
- export function FSharpMap__ToArray<Key, Value>(m: FSharpMap<Key, Value>): [Key, Value][] {
1384
+ export function FSharpMap__ToArray<Key, Value>(m: FSharpMap<Key, Value>): MutableArray<[Key, Value]> {
1383
1385
  return MapTreeModule_toArray<Key, Value>(m.tree);
1384
1386
  }
1385
1387
 
@@ -1420,11 +1422,11 @@ export function tryFind<$a, $b>(key: $a, table: FSharpMap<$a, $b>): Option<$b> {
1420
1422
  return FSharpMap__TryFind<$a, $b>(table, key);
1421
1423
  }
1422
1424
 
1423
- export function remove<$a, $b>(key: Nullable<$a>, table: FSharpMap<$a, $b>): FSharpMap<$a, $b> {
1425
+ export function remove<$a, $b>(key: $a, table: FSharpMap<$a, $b>): FSharpMap<$a, $b> {
1424
1426
  return FSharpMap__Remove<$a, $b>(table, key);
1425
1427
  }
1426
1428
 
1427
- export function containsKey<$a, $b>(key: Nullable<$a>, table: FSharpMap<$a, $b>): boolean {
1429
+ export function containsKey<$a, $b>(key: $a, table: FSharpMap<$a, $b>): boolean {
1428
1430
  return FSharpMap__ContainsKey<$a, $b>(table, key);
1429
1431
  }
1430
1432
 
@@ -1442,7 +1444,7 @@ export function pick<$a, $b, $c>(chooser: ((arg0: $a, arg1: $b) => Option<$c>),
1442
1444
  return value_1(matchValue);
1443
1445
  }
1444
1446
  else {
1445
- throw new Error();
1447
+ throw KeyNotFoundException_$ctor();
1446
1448
  }
1447
1449
  }
1448
1450
 
@@ -1510,7 +1512,7 @@ export function ofSeq<T, $a>(elements: Iterable<[T, $a]>, comparer: IComparer<T>
1510
1512
  return FSharpMap_$ctor<T, $a>(comparer, MapTreeModule_ofSeq<T, $a>(comparer, elements));
1511
1513
  }
1512
1514
 
1513
- export function ofArray<Key, Value>(elements: [Key, Value][], comparer: IComparer<Key>): FSharpMap<Key, Value> {
1515
+ export function ofArray<Key, Value>(elements: MutableArray<[Key, Value]>, comparer: IComparer<Key>): FSharpMap<Key, Value> {
1514
1516
  return FSharpMap_$ctor<Key, Value>(comparer, MapTreeModule_ofSeq<Key, Value>(comparer, elements));
1515
1517
  }
1516
1518
 
@@ -1518,7 +1520,7 @@ export function toList<$a, $b>(table: FSharpMap<$a, $b>): FSharpList<[$a, $b]> {
1518
1520
  return FSharpMap__ToList<$a, $b>(table);
1519
1521
  }
1520
1522
 
1521
- export function toArray<$a, $b>(table: FSharpMap<$a, $b>): [$a, $b][] {
1523
+ export function toArray<$a, $b>(table: FSharpMap<$a, $b>): MutableArray<[$a, $b]> {
1522
1524
  return FSharpMap__ToArray<$a, $b>(table);
1523
1525
  }
1524
1526
 
package/MapUtil.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { equals, IMap, IMapOrWeakMap, ISet } from "./Util.js";
2
- import { FSharpRef, Union } from "./Types.js";
1
+ import { Exception, equals, IMap, IMapOrWeakMap, ISet } from "./Util.ts";
2
+ import { FSharpRef, Union } from "./Types.ts";
3
3
 
4
4
  const CaseRules = {
5
5
  None: 0,
@@ -39,7 +39,7 @@ export function keyValueList(fields: Iterable<any>, caseRule = CaseRules.None) {
39
39
  const definedCaseRule = caseRule;
40
40
 
41
41
  function fail(kvPair: any) {
42
- throw new Error("Cannot infer key and value of " + String(kvPair));
42
+ throw new Exception("Cannot infer key and value of " + String(kvPair));
43
43
  }
44
44
  function assign(key: string, caseRule: number, value: any) {
45
45
  key = changeCase(key, caseRule);
@@ -117,7 +117,7 @@ export function tryAddToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V) {
117
117
 
118
118
  export function addToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V) {
119
119
  if (dict.has(k)) {
120
- throw new Error("An item with the same key has already been added. Key: " + k);
120
+ throw new Exception("An item with the same key has already been added. Key: " + k);
121
121
  }
122
122
  dict.set(k, v);
123
123
  }
@@ -126,7 +126,7 @@ export function getItemFromDict<K, V>(map: IMap<K, V>, key: K) {
126
126
  if (map.has(key)) {
127
127
  return map.get(key) as V;
128
128
  } else {
129
- throw new Error(`The given key '${key}' was not present in the dictionary.`);
129
+ throw new Exception(`The given key '${key}' was not present in the dictionary.`);
130
130
  }
131
131
  }
132
132
 
package/MutableMap.ts CHANGED
@@ -1,13 +1,15 @@
1
1
 
2
- import { IEqualityComparer, IDisposable, disposeSafe, defaultOf, IMap, equals, toIterator, IEnumerator, getEnumerator } from "./Util.js";
3
- import { iterate, map, delay, toArray, iterateIndexed, concat } from "./Seq.js";
4
- import { value as value_1, Option } from "./Option.js";
5
- import { int32 } from "./Int32.js";
6
- import { setItem } from "./Array.js";
7
- import { FSharpRef } from "./Types.js";
8
- import { class_type, TypeInfo } from "./Reflection.js";
9
- import { getItemFromDict, tryGetValue } from "./MapUtil.js";
10
- import { format } from "./String.js";
2
+ import { IEqualityComparer, IDisposable, disposeSafe, defaultOf, IMap, MutableArray, equals, toIterator, IEnumerator, getEnumerator } from "./Util.ts";
3
+ import { iterate, map, delay, toArray, iterateIndexed, concat } from "./Seq.ts";
4
+ import { value as value_1, Option } from "./Option.ts";
5
+ import { int32 } from "./Int32.ts";
6
+ import { setItem } from "./Array.ts";
7
+ import { FSharpRef } from "./Types.ts";
8
+ import { class_type, TypeInfo } from "./Reflection.ts";
9
+ import { getItemFromDict, tryGetValue } from "./MapUtil.ts";
10
+ import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.ts";
11
+ import { ArgumentException_$ctor_Z721C83C5 } from "./System.ts";
12
+ import { format } from "./String.ts";
11
13
 
12
14
  export class Dictionary<Key, Value> implements IMap<Key, Value>, Iterable<[Key, Value]>, Iterable<[Key, Value]> {
13
15
  readonly comparer: IEqualityComparer<Key>;
@@ -59,11 +61,11 @@ export class Dictionary<Key, Value> implements IMap<Key, Value>, Iterable<[Key,
59
61
  "System.Collections.Generic.ICollection`1.Contains2B595"(item: [Key, Value]): boolean {
60
62
  const this$: Dictionary<Key, Value> = this;
61
63
  const matchValue: Option<[Key, Value]> = Dictionary__TryFind_2B595<Key, Value>(this$, item[0]);
62
- let matchResult: int32, p_1: [Key, Value];
64
+ let matchResult: int32 = (undefined as any), pair_1: [Key, Value] = (undefined as any);
63
65
  if (matchValue != null) {
64
66
  if (equals(value_1(matchValue)[1], item[1])) {
65
67
  matchResult = 0;
66
- p_1 = value_1(matchValue);
68
+ pair_1 = value_1(matchValue);
67
69
  }
68
70
  else {
69
71
  matchResult = 1;
@@ -79,7 +81,7 @@ export class Dictionary<Key, Value> implements IMap<Key, Value>, Iterable<[Key,
79
81
  return false;
80
82
  }
81
83
  }
82
- "System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(array: [Key, Value][], arrayIndex: int32): void {
84
+ "System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(array: MutableArray<[Key, Value]>, arrayIndex: int32): void {
83
85
  const this$: Dictionary<Key, Value> = this;
84
86
  iterateIndexed<[Key, Value]>((i: int32, e: [Key, Value]): void => {
85
87
  setItem(array, arrayIndex + i, e);
@@ -95,14 +97,24 @@ export class Dictionary<Key, Value> implements IMap<Key, Value>, Iterable<[Key,
95
97
  "System.Collections.Generic.ICollection`1.Remove2B595"(item: [Key, Value]): boolean {
96
98
  const this$: Dictionary<Key, Value> = this;
97
99
  const matchValue: Option<[Key, Value]> = Dictionary__TryFind_2B595<Key, Value>(this$, item[0]);
100
+ let matchResult: int32 = (undefined as any), pair_1: [Key, Value] = (undefined as any);
98
101
  if (matchValue != null) {
99
102
  if (equals(value_1(matchValue)[1], item[1])) {
100
- Dictionary__Remove_2B595<Key, Value>(this$, item[0]);
103
+ matchResult = 0;
104
+ pair_1 = value_1(matchValue);
105
+ }
106
+ else {
107
+ matchResult = 1;
101
108
  }
102
- return true;
103
109
  }
104
110
  else {
105
- return false;
111
+ matchResult = 1;
112
+ }
113
+ switch (matchResult) {
114
+ case 0:
115
+ return Dictionary__Remove_2B595<Key, Value>(this$, item[0]);
116
+ default:
117
+ return false;
106
118
  }
107
119
  }
108
120
  "System.Collections.Generic.IDictionary`2.Add5BDDA1"(key: Key, value: Value): void {
@@ -215,7 +227,7 @@ function Dictionary__TryFindIndex_2B595<Key, Value>(this$: Dictionary<Key, Value
215
227
 
216
228
  export function Dictionary__TryFind_2B595<Key, Value>(this$: Dictionary<Key, Value>, k: Key): Option<[Key, Value]> {
217
229
  const matchValue: [boolean, int32, int32] = Dictionary__TryFindIndex_2B595<Key, Value>(this$, k);
218
- let matchResult: int32;
230
+ let matchResult: int32 = undefined as any;
219
231
  if (matchValue[0]) {
220
232
  if (matchValue[2] > -1) {
221
233
  matchResult = 0;
@@ -264,7 +276,7 @@ export function Dictionary__get_Item_2B595<Key, Value>(this$: Dictionary<Key, Va
264
276
  return value_1(matchValue)[1];
265
277
  }
266
278
  else {
267
- throw new Error("The item was not found in collection");
279
+ throw KeyNotFoundException_$ctor_Z721C83C5("The item was not found in collection");
268
280
  }
269
281
  }
270
282
 
@@ -287,7 +299,7 @@ export function Dictionary__Add_5BDDA1<Key, Value>(this$: Dictionary<Key, Value>
287
299
  const matchValue: [boolean, int32, int32] = Dictionary__TryFindIndex_2B595<Key, Value>(this$, k);
288
300
  if (matchValue[0]) {
289
301
  if (matchValue[2] > -1) {
290
- throw new Error(format("An item with the same key has already been added. Key: {0}", k));
302
+ throw ArgumentException_$ctor_Z721C83C5(format("An item with the same key has already been added. Key: {0}", k));
291
303
  }
292
304
  else {
293
305
  const value: any = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v] as [Key, Value]));
@@ -300,7 +312,7 @@ export function Dictionary__Add_5BDDA1<Key, Value>(this$: Dictionary<Key, Value>
300
312
 
301
313
  export function Dictionary__ContainsKey_2B595<Key, Value>(this$: Dictionary<Key, Value>, k: Key): boolean {
302
314
  const matchValue: [boolean, int32, int32] = Dictionary__TryFindIndex_2B595<Key, Value>(this$, k);
303
- let matchResult: int32;
315
+ let matchResult: int32 = undefined as any;
304
316
  if (matchValue[0]) {
305
317
  if (matchValue[2] > -1) {
306
318
  matchResult = 0;
@@ -322,7 +334,7 @@ export function Dictionary__ContainsKey_2B595<Key, Value>(this$: Dictionary<Key,
322
334
 
323
335
  export function Dictionary__Remove_2B595<Key, Value>(this$: Dictionary<Key, Value>, k: Key): boolean {
324
336
  const matchValue: [boolean, int32, int32] = Dictionary__TryFindIndex_2B595<Key, Value>(this$, k);
325
- let matchResult: int32;
337
+ let matchResult: int32 = undefined as any;
326
338
  if (matchValue[0]) {
327
339
  if (matchValue[2] > -1) {
328
340
  matchResult = 0;