@fable-org/fable-library-js 2.0.0-rc.3 → 2.0.0-rc.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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ 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-rc.4 - 2026-03-19
11
+
12
+ ### Fixed
13
+
14
+ * [JS/TS] Fix `Unchecked.defaultof<char>` being emitted as `null` instead of `'\0'` (by @MangelMaxime)
15
+
10
16
  ## 2.0.0-rc.3 - 2026-03-10
11
17
 
12
18
  ### Fixed
package/Map.js CHANGED
@@ -806,6 +806,9 @@ export function MapTreeModule_ofSeq(comparer, c) {
806
806
  }
807
807
  }
808
808
  }
809
+ /**
810
+ * Imperative left-to-right iterators.
811
+ */
809
812
  export class MapTreeModule_MapIterator$2 extends Record {
810
813
  constructor(stack, started) {
811
814
  super();
package/MutableMap.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { disposeSafe, defaultOf, equals, toIterator, getEnumerator } from "./Util.js";
2
2
  import { iterate, map, delay, toArray, iterateIndexed, concat } from "./Seq.js";
3
3
  import { value as value_1 } from "./Option.js";
4
- import { setItem } from "./Array.js";
4
+ import { item as item_1, setItem } from "./Array.js";
5
5
  import { FSharpRef } from "./Types.js";
6
6
  import { class_type } from "./Reflection.js";
7
7
  import { getItemFromDict, tryGetValue } from "./MapUtil.js";
@@ -231,7 +231,7 @@ export function Dictionary__TryFind_2B595(this$, k) {
231
231
  }
232
232
  switch (matchResult) {
233
233
  case 0:
234
- return getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]];
234
+ return item_1(matchValue[2], getItemFromDict(this$.hashMap, matchValue[1]));
235
235
  default:
236
236
  return undefined;
237
237
  }
@@ -269,7 +269,7 @@ export function Dictionary__set_Item_5BDDA1(this$, k, v) {
269
269
  const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
270
270
  if (matchValue[0]) {
271
271
  if (matchValue[2] > -1) {
272
- getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]] = [k, v];
272
+ setItem(getItemFromDict(this$.hashMap, matchValue[1]), matchValue[2], [k, v]);
273
273
  }
274
274
  else {
275
275
  const value = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
package/MutableSet.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { disposeSafe, defaultOf, toIterator, getEnumerator } from "./Util.js";
2
2
  import { iterate, map, iterateIndexed, concat } from "./Seq.js";
3
- import { setItem } from "./Array.js";
3
+ import { item as item_1, setItem } from "./Array.js";
4
4
  import { some } from "./Option.js";
5
5
  import { FSharpRef } from "./Types.js";
6
6
  import { class_type } from "./Reflection.js";
@@ -146,7 +146,7 @@ function HashSet__TryFind_2B595(this$, k) {
146
146
  }
147
147
  switch (matchResult) {
148
148
  case 0:
149
- return some(getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]]);
149
+ return some(item_1(matchValue[2], getItemFromDict(this$.hashMap, matchValue[1])));
150
150
  default:
151
151
  return undefined;
152
152
  }
package/Reflection.js CHANGED
@@ -431,8 +431,7 @@ export function createInstance(t, consArgs) {
431
431
  case decimal_type.fullname:
432
432
  return new Decimal(0);
433
433
  case char_type.fullname:
434
- // Even though char is a value type, it's erased to string, and Unchecked.defaultof<char> is null
435
- return null;
434
+ return "\0";
436
435
  default:
437
436
  throw new Exception(`Cannot access constructor of ${t.fullname}`);
438
437
  }
package/Seq.js CHANGED
@@ -5,7 +5,7 @@ import { class_type } from "./Reflection.js";
5
5
  import { some, value as value_1 } from "./Option.js";
6
6
  import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
7
7
  import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.js";
8
- 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";
8
+ 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, item as item_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";
9
9
  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";
10
10
  import { SR_indexOutOfBounds } from "./Global.js";
11
11
  export const SR_enumerationAlreadyFinished = "Enumeration already finished.";
@@ -954,7 +954,7 @@ export function cache(source) {
954
954
  });
955
955
  }, unfold((i_1) => Operators_Lock(prefix, () => {
956
956
  if (i_1 < prefix.length) {
957
- return [prefix[i_1], i_1 + 1];
957
+ return [item_1(i_1, prefix), i_1 + 1];
958
958
  }
959
959
  else {
960
960
  if (i_1 >= prefix.length) {
@@ -981,7 +981,7 @@ export function cache(source) {
981
981
  }
982
982
  }
983
983
  if (i_1 < prefix.length) {
984
- return [prefix[i_1], i_1 + 1];
984
+ return [item_1(i_1, prefix), i_1 + 1];
985
985
  }
986
986
  else {
987
987
  return undefined;
package/System.Text.js CHANGED
@@ -2,6 +2,7 @@ import { replace, format, replicate, substring, isNullOrEmpty, join } from "./St
2
2
  import { class_type } from "./Reflection.js";
3
3
  import { toString } from "./Types.js";
4
4
  import { Exception, clear, int32ToString } from "./Util.js";
5
+ import { setItem, item } from "./Array.js";
5
6
  export class StringBuilder {
6
7
  constructor(value, capacity) {
7
8
  this.buf = [];
@@ -118,8 +119,8 @@ export function StringBuilder__Clear(x) {
118
119
  export function StringBuilder__get_Chars_Z524259A4(x, index) {
119
120
  let len = 0;
120
121
  let i = 0;
121
- while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
122
- len = ((len + x.buf[i].length) | 0);
122
+ while ((i < x.buf.length) && ((len + item(i, x.buf).length) <= index)) {
123
+ len = ((len + item(i, x.buf).length) | 0);
123
124
  i = ((i + 1) | 0);
124
125
  }
125
126
  if ((index < 0) ? true : (i >= x.buf.length)) {
@@ -127,14 +128,14 @@ export function StringBuilder__get_Chars_Z524259A4(x, index) {
127
128
  }
128
129
  else {
129
130
  const pos = (index - len) | 0;
130
- return x.buf[i][pos];
131
+ return item(i, x.buf)[pos];
131
132
  }
132
133
  }
133
134
  export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
134
135
  let len = 0;
135
136
  let i = 0;
136
- while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
137
- len = ((len + x.buf[i].length) | 0);
137
+ while ((i < x.buf.length) && ((len + item(i, x.buf).length) <= index)) {
138
+ len = ((len + item(i, x.buf).length) | 0);
138
139
  i = ((i + 1) | 0);
139
140
  }
140
141
  if ((index < 0) ? true : (i >= x.buf.length)) {
@@ -142,12 +143,12 @@ export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
142
143
  }
143
144
  else {
144
145
  const pos = (index - len) | 0;
145
- x.buf[i] = ((x.buf[i].slice(0, (pos - 1) + 1) + value) + x.buf[i].slice(pos + 1, x.buf[i].length));
146
+ setItem(x.buf, i, (item(i, x.buf).slice(0, (pos - 1) + 1) + value) + item(i, x.buf).slice(pos + 1, item(i, x.buf).length));
146
147
  }
147
148
  }
148
149
  export function StringBuilder__Replace_Z766F94C0(x, oldValue, newValue) {
149
150
  for (let i = x.buf.length - 1; i >= 0; i--) {
150
- x.buf[i] = replace(x.buf[i], oldValue, newValue);
151
+ setItem(x.buf, i, replace(item(i, x.buf), oldValue, newValue));
151
152
  }
152
153
  return x;
153
154
  }
@@ -158,7 +159,7 @@ export function StringBuilder__Replace_Z384F8060(x, oldValue, newValue) {
158
159
  export function StringBuilder__get_Length(x) {
159
160
  let len = 0;
160
161
  for (let i = x.buf.length - 1; i >= 0; i--) {
161
- len = ((len + x.buf[i].length) | 0);
162
+ len = ((len + item(i, x.buf).length) | 0);
162
163
  }
163
164
  return len | 0;
164
165
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "2.0.0-rc.3",
6
+ "version": "2.0.0-rc.4",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",