@fable-org/fable-library-ts 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.ts CHANGED
@@ -881,6 +881,9 @@ export function MapTreeModule_ofSeq<Key, Value>(comparer: IComparer<Key>, c: Ite
881
881
  }
882
882
  }
883
883
 
884
+ /**
885
+ * Imperative left-to-right iterators.
886
+ */
884
887
  export class MapTreeModule_MapIterator$2<Key, Value> extends Record {
885
888
  stack: FSharpList<Option<MapTreeLeaf$2<Key, Value>>>;
886
889
  started: boolean;
package/MutableMap.ts CHANGED
@@ -3,7 +3,7 @@ import { IEqualityComparer, IDisposable, disposeSafe, defaultOf, IMap, MutableAr
3
3
  import { iterate, map, delay, toArray, iterateIndexed, concat } from "./Seq.ts";
4
4
  import { value as value_1, Option } from "./Option.ts";
5
5
  import { int32 } from "./Int32.ts";
6
- import { setItem } from "./Array.ts";
6
+ import { item as item_1, setItem } from "./Array.ts";
7
7
  import { FSharpRef } from "./Types.ts";
8
8
  import { class_type, TypeInfo } from "./Reflection.ts";
9
9
  import { getItemFromDict, tryGetValue } from "./MapUtil.ts";
@@ -241,7 +241,7 @@ export function Dictionary__TryFind_2B595<Key, Value>(this$: Dictionary<Key, Val
241
241
  }
242
242
  switch (matchResult) {
243
243
  case 0:
244
- return getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]];
244
+ return item_1(matchValue[2], getItemFromDict(this$.hashMap, matchValue[1]));
245
245
  default:
246
246
  return undefined;
247
247
  }
@@ -284,7 +284,7 @@ export function Dictionary__set_Item_5BDDA1<Key, Value>(this$: Dictionary<Key, V
284
284
  const matchValue: [boolean, int32, int32] = Dictionary__TryFindIndex_2B595<Key, Value>(this$, k);
285
285
  if (matchValue[0]) {
286
286
  if (matchValue[2] > -1) {
287
- getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]] = ([k, v] as [Key, Value]);
287
+ setItem(getItemFromDict(this$.hashMap, matchValue[1]), matchValue[2], [k, v] as [Key, Value]);
288
288
  }
289
289
  else {
290
290
  const value: any = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v] as [Key, Value]));
package/MutableSet.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { IMap, IEqualityComparer, IDisposable, disposeSafe, defaultOf, ISet, MutableArray, toIterator, IEnumerator, getEnumerator } from "./Util.ts";
3
3
  import { iterate, map, iterateIndexed, concat } from "./Seq.ts";
4
- import { setItem } from "./Array.ts";
4
+ import { item as item_1, setItem } from "./Array.ts";
5
5
  import { int32 } from "./Int32.ts";
6
6
  import { some, Option } from "./Option.ts";
7
7
  import { FSharpRef } from "./Types.ts";
@@ -156,7 +156,7 @@ function HashSet__TryFind_2B595<T>(this$: HashSet<T>, k: T): Option<T> {
156
156
  }
157
157
  switch (matchResult) {
158
158
  case 0:
159
- return some(getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]]);
159
+ return some(item_1(matchValue[2], getItemFromDict(this$.hashMap, matchValue[1])));
160
160
  default:
161
161
  return undefined;
162
162
  }
package/Reflection.ts CHANGED
@@ -536,8 +536,7 @@ export function createInstance(t: TypeInfo, consArgs?: any[]): any {
536
536
  case decimal_type.fullname:
537
537
  return new Decimal(0);
538
538
  case char_type.fullname:
539
- // Even though char is a value type, it's erased to string, and Unchecked.defaultof<char> is null
540
- return null;
539
+ return "\0";
541
540
  default:
542
541
  throw new Exception(`Cannot access constructor of ${t.fullname}`);
543
542
  }
package/Seq.ts CHANGED
@@ -6,7 +6,7 @@ import { class_type, TypeInfo } from "./Reflection.ts";
6
6
  import { some, value as value_1, Option } from "./Option.ts";
7
7
  import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.ts";
8
8
  import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.ts";
9
- 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.ts";
9
+ 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.ts";
10
10
  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.ts";
11
11
  import { int32 } from "./Int32.ts";
12
12
  import { SR_indexOutOfBounds } from "./Global.ts";
@@ -1054,7 +1054,7 @@ export function cache<T>(source: Iterable<T>): Iterable<T> {
1054
1054
  });
1055
1055
  }, unfold<int32, T>((i_1: int32): Option<[T, int32]> => Operators_Lock<T[], Option<[T, int32]>>(prefix, (): Option<[T, int32]> => {
1056
1056
  if (i_1 < prefix.length) {
1057
- return [prefix[i_1], i_1 + 1] as [T, int32];
1057
+ return [item_1(i_1, prefix), i_1 + 1] as [T, int32];
1058
1058
  }
1059
1059
  else {
1060
1060
  if (i_1 >= prefix.length) {
@@ -1081,7 +1081,7 @@ export function cache<T>(source: Iterable<T>): Iterable<T> {
1081
1081
  }
1082
1082
  }
1083
1083
  if (i_1 < prefix.length) {
1084
- return [prefix[i_1], i_1 + 1] as [T, int32];
1084
+ return [item_1(i_1, prefix), i_1 + 1] as [T, int32];
1085
1085
  }
1086
1086
  else {
1087
1087
  return undefined;
package/System.Text.ts CHANGED
@@ -4,6 +4,7 @@ import { float64, int32 } from "./Int32.ts";
4
4
  import { class_type, TypeInfo } from "./Reflection.ts";
5
5
  import { toString } from "./Types.ts";
6
6
  import { Exception, clear, MutableArray, int32ToString } from "./Util.ts";
7
+ import { setItem, item } from "./Array.ts";
7
8
 
8
9
  export class StringBuilder {
9
10
  readonly buf: string[];
@@ -149,8 +150,8 @@ export function StringBuilder__Clear(x: StringBuilder): StringBuilder {
149
150
  export function StringBuilder__get_Chars_Z524259A4(x: StringBuilder, index: int32): string {
150
151
  let len = 0;
151
152
  let i = 0;
152
- while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
153
- len = ((len + x.buf[i].length) | 0);
153
+ while ((i < x.buf.length) && ((len + item(i, x.buf).length) <= index)) {
154
+ len = ((len + item(i, x.buf).length) | 0);
154
155
  i = ((i + 1) | 0);
155
156
  }
156
157
  if ((index < 0) ? true : (i >= x.buf.length)) {
@@ -158,15 +159,15 @@ export function StringBuilder__get_Chars_Z524259A4(x: StringBuilder, index: int3
158
159
  }
159
160
  else {
160
161
  const pos: int32 = (index - len) | 0;
161
- return x.buf[i][pos];
162
+ return item(i, x.buf)[pos];
162
163
  }
163
164
  }
164
165
 
165
166
  export function StringBuilder__set_Chars_413E0D0A(x: StringBuilder, index: int32, value: string): void {
166
167
  let len = 0;
167
168
  let i = 0;
168
- while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
169
- len = ((len + x.buf[i].length) | 0);
169
+ while ((i < x.buf.length) && ((len + item(i, x.buf).length) <= index)) {
170
+ len = ((len + item(i, x.buf).length) | 0);
170
171
  i = ((i + 1) | 0);
171
172
  }
172
173
  if ((index < 0) ? true : (i >= x.buf.length)) {
@@ -174,13 +175,13 @@ export function StringBuilder__set_Chars_413E0D0A(x: StringBuilder, index: int32
174
175
  }
175
176
  else {
176
177
  const pos: int32 = (index - len) | 0;
177
- x.buf[i] = ((x.buf[i].slice(0, (pos - 1) + 1) + value) + x.buf[i].slice(pos + 1, x.buf[i].length));
178
+ 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));
178
179
  }
179
180
  }
180
181
 
181
182
  export function StringBuilder__Replace_Z766F94C0(x: StringBuilder, oldValue: string, newValue: string): StringBuilder {
182
183
  for (let i: int32 = x.buf.length - 1; i >= 0; i--) {
183
- x.buf[i] = replace(x.buf[i], oldValue, newValue);
184
+ setItem(x.buf, i, replace(item(i, x.buf), oldValue, newValue));
184
185
  }
185
186
  return x;
186
187
  }
@@ -193,7 +194,7 @@ export function StringBuilder__Replace_Z384F8060(x: StringBuilder, oldValue: str
193
194
  export function StringBuilder__get_Length(x: StringBuilder): int32 {
194
195
  let len = 0;
195
196
  for (let i: int32 = x.buf.length - 1; i >= 0; i--) {
196
- len = ((len + x.buf[i].length) | 0);
197
+ len = ((len + item(i, x.buf).length) | 0);
197
198
  }
198
199
  return len | 0;
199
200
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
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",