@fable-org/fable-library-ts 2.1.1 → 2.2.0

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.ts CHANGED
@@ -47,7 +47,7 @@ export function getSubArray<T>(array: MutableArray<T>, start: int32, count: int3
47
47
 
48
48
  export function last<T>(array: MutableArray<T>): T {
49
49
  if (array.length === 0) {
50
- throw new Exception("The input array was empty\\nParameter name: array");
50
+ throw new Exception("The input array was empty (Parameter \'array\')");
51
51
  }
52
52
  return item_2(array.length - 1, array);
53
53
  }
@@ -246,7 +246,7 @@ export function singleton<T>(value: T, cons?: any): MutableArray<T> {
246
246
 
247
247
  export function initialize<T>(count: int32, initializer: ((arg0: int32) => T), cons?: any): MutableArray<T> {
248
248
  if (count < 0) {
249
- throw new Exception("The input must be non-negative\\nParameter name: count");
249
+ throw new Exception("The input must be non-negative (Parameter \'count\')");
250
250
  }
251
251
  const result: MutableArray<T> = Helpers_allocateArrayFromCons<T>(cons, count);
252
252
  for (let i = 0; i <= (count - 1); i++) {
@@ -271,7 +271,7 @@ export function pairwise<T>(array: MutableArray<T>): MutableArray<[T, T]> {
271
271
 
272
272
  export function replicate<T>(count: int32, initial: T, cons?: any): MutableArray<T> {
273
273
  if (count < 0) {
274
- throw new Exception("The input must be non-negative\\nParameter name: count");
274
+ throw new Exception("The input must be non-negative (Parameter \'count\')");
275
275
  }
276
276
  const result: MutableArray<T> = Helpers_allocateArrayFromCons<T>(cons, count);
277
277
  for (let i = 0; i <= (result.length - 1); i++) {
@@ -313,7 +313,7 @@ export function scanBack<T, State>(folder: ((arg0: T, arg1: State) => State), ar
313
313
 
314
314
  export function skip<T>(count: int32, array: MutableArray<T>, cons?: any): MutableArray<T> {
315
315
  if (count > array.length) {
316
- throw new Exception("count is greater than array length\\nParameter name: count");
316
+ throw new Exception("count is greater than array length (Parameter \'count\')");
317
317
  }
318
318
  if (count === array.length) {
319
319
  return Helpers_allocateArrayFromCons<T>(cons, 0);
@@ -340,10 +340,10 @@ export function skipWhile<T>(predicate: ((arg0: T) => boolean), array: MutableAr
340
340
 
341
341
  export function take<T>(count: int32, array: MutableArray<T>, cons?: any): MutableArray<T> {
342
342
  if (count < 0) {
343
- throw new Exception("The input must be non-negative\\nParameter name: count");
343
+ throw new Exception("The input must be non-negative (Parameter \'count\')");
344
344
  }
345
345
  if (count > array.length) {
346
- throw new Exception("count is greater than array length\\nParameter name: count");
346
+ throw new Exception("count is greater than array length (Parameter \'count\')");
347
347
  }
348
348
  if (count === 0) {
349
349
  return Helpers_allocateArrayFromCons<T>(cons, 0);
@@ -854,7 +854,7 @@ export function zip3<T, U, V>(array1: MutableArray<T>, array2: MutableArray<U>,
854
854
 
855
855
  export function chunkBySize<T>(chunkSize: int32, array: MutableArray<T>): MutableArray<MutableArray<T>> {
856
856
  if (chunkSize < 1) {
857
- throw new Exception("The input must be positive.\\nParameter name: size");
857
+ throw new Exception("The input must be positive. (Parameter \'size\')");
858
858
  }
859
859
  const result: MutableArray<T>[] = [];
860
860
  if (array.length > 0) {
@@ -871,7 +871,7 @@ export function chunkBySize<T>(chunkSize: int32, array: MutableArray<T>): Mutabl
871
871
 
872
872
  export function splitAt<T>(index: int32, array: MutableArray<T>): [MutableArray<T>, MutableArray<T>] {
873
873
  if ((index < 0) ? true : (index > array.length)) {
874
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
874
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
875
875
  }
876
876
  return [array.slice(0, (0 + index)), array.slice(index)] as [MutableArray<T>, MutableArray<T>];
877
877
  }
@@ -984,9 +984,9 @@ export function exactlyOne<T>(array: MutableArray<T>): T {
984
984
  case 1:
985
985
  return item_2(0, array);
986
986
  case 0:
987
- throw new Exception("The input sequence was empty\\nParameter name: array");
987
+ throw new Exception("The input sequence was empty (Parameter \'array\')");
988
988
  default:
989
- throw new Exception("Input array too long\\nParameter name: array");
989
+ throw new Exception("Input array too long (Parameter \'array\')");
990
990
  }
991
991
  }
992
992
 
@@ -1001,7 +1001,7 @@ export function tryExactlyOne<T>(array: MutableArray<T>): Option<T> {
1001
1001
 
1002
1002
  export function head<T>(array: MutableArray<T>): T {
1003
1003
  if (array.length === 0) {
1004
- throw new Exception("The input array was empty\\nParameter name: array");
1004
+ throw new Exception("The input array was empty (Parameter \'array\')");
1005
1005
  }
1006
1006
  else {
1007
1007
  return item_2(0, array);
@@ -1019,14 +1019,14 @@ export function tryHead<T>(array: MutableArray<T>): Option<T> {
1019
1019
 
1020
1020
  export function tail<T>(array: MutableArray<T>): MutableArray<T> {
1021
1021
  if (array.length === 0) {
1022
- throw new Exception("Not enough elements\\nParameter name: array");
1022
+ throw new Exception("Not enough elements (Parameter \'array\')");
1023
1023
  }
1024
1024
  return array.slice(1);
1025
1025
  }
1026
1026
 
1027
1027
  export function item<T>(index: int32, array: MutableArray<T>): T {
1028
1028
  if ((index < 0) ? true : (index >= array.length)) {
1029
- throw new Exception("Index was outside the bounds of the array.\\nParameter name: index");
1029
+ throw new Exception("Index was outside the bounds of the array. (Parameter \'index\')");
1030
1030
  }
1031
1031
  else {
1032
1032
  return array[index];
@@ -1035,7 +1035,7 @@ export function item<T>(index: int32, array: MutableArray<T>): T {
1035
1035
 
1036
1036
  export function setItem<T>(array: MutableArray<T>, index: int32, value: T): void {
1037
1037
  if ((index < 0) ? true : (index >= array.length)) {
1038
- throw new Exception("Index was outside the bounds of the array.\\nParameter name: index");
1038
+ throw new Exception("Index was outside the bounds of the array. (Parameter \'index\')");
1039
1039
  }
1040
1040
  else {
1041
1041
  array[index] = value;
@@ -1196,7 +1196,7 @@ export function min<a>(xs: MutableArray<a>, comparer: IComparer<a>): a {
1196
1196
 
1197
1197
  export function average<T>(array: MutableArray<T>, averager: any): T {
1198
1198
  if (array.length === 0) {
1199
- throw new Exception("The input array was empty\\nParameter name: array");
1199
+ throw new Exception("The input array was empty (Parameter \'array\')");
1200
1200
  }
1201
1201
  let total: T = averager.GetZero();
1202
1202
  for (let i = 0; i <= (array.length - 1); i++) {
@@ -1207,7 +1207,7 @@ export function average<T>(array: MutableArray<T>, averager: any): T {
1207
1207
 
1208
1208
  export function averageBy<T, T2>(projection: ((arg0: T) => T2), array: MutableArray<T>, averager: any): T2 {
1209
1209
  if (array.length === 0) {
1210
- throw new Exception("The input array was empty\\nParameter name: array");
1210
+ throw new Exception("The input array was empty (Parameter \'array\')");
1211
1211
  }
1212
1212
  let total: T2 = averager.GetZero();
1213
1213
  for (let i = 0; i <= (array.length - 1); i++) {
@@ -1231,7 +1231,7 @@ export function windowed<T>(windowSize: int32, source: MutableArray<T>): Mutable
1231
1231
 
1232
1232
  export function splitInto<T>(chunks: int32, array: MutableArray<T>): MutableArray<MutableArray<T>> {
1233
1233
  if (chunks < 1) {
1234
- throw new Exception("The input must be positive.\\nParameter name: chunks");
1234
+ throw new Exception("The input must be positive. (Parameter \'chunks\')");
1235
1235
  }
1236
1236
  const result: MutableArray<T>[] = [];
1237
1237
  if (array.length > 0) {
@@ -1275,7 +1275,7 @@ export function transpose<T>(arrays: Iterable<MutableArray<T>>, cons?: any): Mut
1275
1275
  export function insertAt<T>(index: int32, y: T, xs: MutableArray<T>, cons?: any): MutableArray<T> {
1276
1276
  const len: int32 = xs.length | 0;
1277
1277
  if ((index < 0) ? true : (index > len)) {
1278
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1278
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1279
1279
  }
1280
1280
  const target: MutableArray<T> = Helpers_allocateArrayFromCons<T>(cons, len + 1);
1281
1281
  for (let i = 0; i <= (index - 1); i++) {
@@ -1291,7 +1291,7 @@ export function insertAt<T>(index: int32, y: T, xs: MutableArray<T>, cons?: any)
1291
1291
  export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: MutableArray<T>, cons?: any): MutableArray<T> {
1292
1292
  const len: int32 = xs.length | 0;
1293
1293
  if ((index < 0) ? true : (index > len)) {
1294
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1294
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1295
1295
  }
1296
1296
  const ys_1: MutableArray<T> = Array.from(ys);
1297
1297
  const len2: int32 = ys_1.length | 0;
@@ -1313,7 +1313,7 @@ export function randomShuffleInPlaceBy<T>(randomizer: (() => float64), xs: Mutab
1313
1313
  for (let i: int32 = len - 1; i >= 1; i--) {
1314
1314
  const r: float64 = randomizer();
1315
1315
  if ((r < 0) ? true : (r >= 1)) {
1316
- throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
1316
+ throw new Exception(SR_Arg_ArgumentOutOfRangeException + " (Parameter \'randomizer\')");
1317
1317
  }
1318
1318
  const j: int32 = ~~(r * (i + 1)) | 0;
1319
1319
  const tmp: T = item_2(i, xs);
@@ -1346,12 +1346,12 @@ export function randomShuffle<T>(xs: MutableArray<T>): MutableArray<T> {
1346
1346
 
1347
1347
  export function randomChoiceBy<T>(randomizer: (() => float64), xs: MutableArray<T>): T {
1348
1348
  if (isEmpty<T>(xs)) {
1349
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
1349
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
1350
1350
  }
1351
1351
  const len: int32 = xs.length | 0;
1352
1352
  const r: float64 = randomizer();
1353
1353
  if ((r < 0) ? true : (r >= 1)) {
1354
- throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
1354
+ throw new Exception(SR_Arg_ArgumentOutOfRangeException + " (Parameter \'randomizer\')");
1355
1355
  }
1356
1356
  return item_2(~~(r * len), xs);
1357
1357
  }
@@ -1366,16 +1366,16 @@ export function randomChoice<T>(xs: MutableArray<T>): T {
1366
1366
 
1367
1367
  export function randomChoicesBy<T>(randomizer: (() => float64), count: int32, xs: MutableArray<T>, cons?: any): MutableArray<T> {
1368
1368
  if (count < 0) {
1369
- throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
1369
+ throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'count\')");
1370
1370
  }
1371
1371
  if ((count > 0) && isEmpty<T>(xs)) {
1372
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
1372
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
1373
1373
  }
1374
1374
  const len: int32 = xs.length | 0;
1375
1375
  return initialize<T>(count, (_arg: int32): T => {
1376
1376
  const r: float64 = randomizer();
1377
1377
  if ((r < 0) ? true : (r >= 1)) {
1378
- throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
1378
+ throw new Exception(SR_Arg_ArgumentOutOfRangeException + " (Parameter \'randomizer\')");
1379
1379
  }
1380
1380
  return item_2(~~(r * len), xs);
1381
1381
  }, cons);
@@ -1391,20 +1391,20 @@ export function randomChoices<T>(count: int32, xs: MutableArray<T>, cons?: any):
1391
1391
 
1392
1392
  export function randomSampleBy<T>(randomizer: (() => float64), count: int32, xs: MutableArray<T>): MutableArray<T> {
1393
1393
  if (count < 0) {
1394
- throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
1394
+ throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'count\')");
1395
1395
  }
1396
1396
  const arr: MutableArray<T> = copy<T>(xs);
1397
1397
  const len: int32 = arr.length | 0;
1398
1398
  if ((len === 0) && (count > 0)) {
1399
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
1399
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
1400
1400
  }
1401
1401
  if (count > len) {
1402
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "count");
1402
+ throw new Exception(SR_notEnoughElements + " (Parameter \'count\')");
1403
1403
  }
1404
1404
  for (let i = 0; i <= (count - 1); i++) {
1405
1405
  const r: float64 = randomizer();
1406
1406
  if ((r < 0) ? true : (r >= 1)) {
1407
- throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
1407
+ throw new Exception(SR_Arg_ArgumentOutOfRangeException + " (Parameter \'randomizer\')");
1408
1408
  }
1409
1409
  const j: int32 = (i + ~~(r * (len - i))) | 0;
1410
1410
  const tmp: T = item_2(i, arr);
@@ -1424,7 +1424,7 @@ export function randomSample<T>(count: int32, xs: MutableArray<T>): MutableArray
1424
1424
 
1425
1425
  export function removeAt<T>(index: int32, xs: MutableArray<T>): MutableArray<T> {
1426
1426
  if ((index < 0) ? true : (index >= xs.length)) {
1427
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1427
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1428
1428
  }
1429
1429
  let i = -1;
1430
1430
  return filter<T>((_arg: T): boolean => {
@@ -1457,7 +1457,7 @@ export function removeManyAt<T>(index: int32, count: int32, xs: MutableArray<T>)
1457
1457
  }, xs);
1458
1458
  const status_1: int32 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
1459
1459
  if (status_1 < 1) {
1460
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
1460
+ throw new Exception(SR_indexOutOfBounds + ((" (Parameter \'" + ((status_1 < 0) ? "index" : "count")) + "\')"));
1461
1461
  }
1462
1462
  return ys;
1463
1463
  }
@@ -1465,7 +1465,7 @@ export function removeManyAt<T>(index: int32, count: int32, xs: MutableArray<T>)
1465
1465
  export function updateAt<T>(index: int32, y: T, xs: MutableArray<T>, cons?: any): MutableArray<T> {
1466
1466
  const len: int32 = xs.length | 0;
1467
1467
  if ((index < 0) ? true : (index >= len)) {
1468
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1468
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1469
1469
  }
1470
1470
  const target: MutableArray<T> = Helpers_allocateArrayFromCons<T>(cons, len);
1471
1471
  for (let i = 0; i <= (len - 1); i++) {
@@ -1477,7 +1477,7 @@ export function updateAt<T>(index: int32, y: T, xs: MutableArray<T>, cons?: any)
1477
1477
  export function resize<T>(xs: FSharpRef<MutableArray<T>>, newSize: int32, zero?: Option<T>, cons?: any): void {
1478
1478
  let array: MutableArray<T> = (undefined as any), array_1: MutableArray<T> = (undefined as any), start_2: int32 = (undefined as any), count_2: int32 = (undefined as any);
1479
1479
  if (newSize < 0) {
1480
- throw new Exception("The input must be non-negative.\\nParameter name: newSize");
1480
+ throw new Exception("The input must be non-negative. (Parameter \'newSize\')");
1481
1481
  }
1482
1482
  const zero_1: T = defaultArg<T>(zero, defaultOf());
1483
1483
  if (Operators_IsNull<any>(xs.contents)) {
package/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 15eb83ed36657f75073fb0e1b4cac677e24fc9bb
2
+ last_commit_released: c9b3ee2429a4688946c1936e27df730837428070
3
3
  updaters:
4
4
  - package.json:
5
5
  file: package.json
@@ -15,6 +15,14 @@ All notable changes to this project will be documented in this file.
15
15
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
16
16
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
17
 
18
+ ## 2.2.0 - 2026-06-24
19
+
20
+ ### 🚀 Features
21
+
22
+ * *(all)* Support Exception.InnerException across all targets (#4677) ([c9b3ee24](https://github.com/fable-compiler/Fable/commit/c9b3ee2429a4688946c1936e27df730837428070))
23
+
24
+ <strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/15eb83ed36657f75073fb0e1b4cac677e24fc9bb..c9b3ee2429a4688946c1936e27df730837428070)</small></strong>
25
+
18
26
  ## 2.1.1 - 2026-06-10
19
27
 
20
28
  ### 🐞 Bug Fixes
package/List.ts CHANGED
@@ -243,7 +243,7 @@ export function FSharpList__get_Head<T>(xs: FSharpList<T>): T {
243
243
  return xs.head;
244
244
  }
245
245
  else {
246
- throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
246
+ throw new Exception(SR_inputWasEmpty + " (Parameter \'list\')");
247
247
  }
248
248
  }
249
249
 
@@ -253,7 +253,7 @@ export function FSharpList__get_Tail<T>(xs: FSharpList<T>): FSharpList<T> {
253
253
  return value_1(matchValue);
254
254
  }
255
255
  else {
256
- throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
256
+ throw new Exception(SR_inputWasEmpty + " (Parameter \'list\')");
257
257
  }
258
258
  }
259
259
 
@@ -274,7 +274,7 @@ export function FSharpList__get_Item_Z524259A4<T>(xs: FSharpList<T>, index: int3
274
274
  }
275
275
  }
276
276
  else {
277
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
277
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
278
278
  }
279
279
  break;
280
280
  }
@@ -1026,7 +1026,7 @@ export function exists2<T1, T2>(f_mut: ((arg0: T1, arg1: T2) => boolean), xs_mut
1026
1026
  continue exists2;
1027
1027
  }
1028
1028
  default:
1029
- throw new Exception((SR_differentLengths + "\\nParameter name: ") + "list2");
1029
+ throw new Exception(SR_differentLengths + " (Parameter \'list2\')");
1030
1030
  }
1031
1031
  break;
1032
1032
  }
@@ -1143,7 +1143,7 @@ export function skip<T>(count_mut: int32, xs_mut: FSharpList<T>): FSharpList<T>
1143
1143
  return xs;
1144
1144
  }
1145
1145
  else if (FSharpList__get_IsEmpty<T>(xs)) {
1146
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
1146
+ throw new Exception(SR_notEnoughElements + " (Parameter \'list\')");
1147
1147
  }
1148
1148
  else {
1149
1149
  count_mut = (count - 1);
@@ -1175,7 +1175,7 @@ export function skipWhile<T>(predicate_mut: ((arg0: T) => boolean), xs_mut: FSha
1175
1175
 
1176
1176
  export function take<T>(count: int32, xs: FSharpList<T>): FSharpList<T> {
1177
1177
  if (count < 0) {
1178
- throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
1178
+ throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'count\')");
1179
1179
  }
1180
1180
  const loop = (i_mut: int32, acc_mut: FSharpList<T>, xs_1_mut: FSharpList<T>): FSharpList<T> => {
1181
1181
  loop:
@@ -1186,7 +1186,7 @@ export function take<T>(count: int32, xs: FSharpList<T>): FSharpList<T> {
1186
1186
  return acc;
1187
1187
  }
1188
1188
  else if (FSharpList__get_IsEmpty<T>(xs_1)) {
1189
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
1189
+ throw new Exception(SR_notEnoughElements + " (Parameter \'list\')");
1190
1190
  }
1191
1191
  else {
1192
1192
  i_mut = (i - 1);
@@ -1277,23 +1277,23 @@ export function getSlice<T>(startIndex: Option<int32>, endIndex: Option<int32>,
1277
1277
 
1278
1278
  export function splitAt<T>(index: int32, xs: FSharpList<T>): [FSharpList<T>, FSharpList<T>] {
1279
1279
  if (index < 0) {
1280
- throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "index");
1280
+ throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'index\')");
1281
1281
  }
1282
1282
  if (index > FSharpList__get_Length<T>(xs)) {
1283
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
1283
+ throw new Exception(SR_notEnoughElements + " (Parameter \'index\')");
1284
1284
  }
1285
1285
  return [take<T>(index, xs), skip<T>(index, xs)] as [FSharpList<T>, FSharpList<T>];
1286
1286
  }
1287
1287
 
1288
1288
  export function exactlyOne<T>(xs: FSharpList<T>): T {
1289
1289
  if (FSharpList__get_IsEmpty<T>(xs)) {
1290
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "list");
1290
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'list\')");
1291
1291
  }
1292
1292
  else if (FSharpList__get_IsEmpty<T>(FSharpList__get_Tail<T>(xs))) {
1293
1293
  return FSharpList__get_Head<T>(xs);
1294
1294
  }
1295
1295
  else {
1296
- throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "list");
1296
+ throw new Exception(SR_inputSequenceTooLong + " (Parameter \'list\')");
1297
1297
  }
1298
1298
  }
1299
1299
 
@@ -1340,7 +1340,7 @@ export function insertAt<T>(index: int32, y: T, xs: FSharpList<T>): FSharpList<T
1340
1340
  }
1341
1341
  }, FSharpList_get_Empty<T>(), xs);
1342
1342
  return reverse<T>(isDone ? result : (((i + 1) === index) ? FSharpList_Cons_305B8EAC<T>(y, result) : (() => {
1343
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1343
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1344
1344
  })()));
1345
1345
  }
1346
1346
 
@@ -1359,7 +1359,7 @@ export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: FSharpList<T>
1359
1359
  }
1360
1360
  }, FSharpList_get_Empty<T>(), xs);
1361
1361
  return reverse<T>(isDone ? result : (((i + 1) === index) ? append<T>(ys_1, result) : (() => {
1362
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1362
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1363
1363
  })()));
1364
1364
  }
1365
1365
 
@@ -1377,7 +1377,7 @@ export function removeAt<T>(index: int32, xs: FSharpList<T>): FSharpList<T> {
1377
1377
  }
1378
1378
  }, xs);
1379
1379
  if (!isDone) {
1380
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1380
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1381
1381
  }
1382
1382
  return ys;
1383
1383
  }
@@ -1406,7 +1406,7 @@ export function removeManyAt<T>(index: int32, count: int32, xs: FSharpList<T>):
1406
1406
  }, xs);
1407
1407
  const status_1: int32 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
1408
1408
  if (status_1 < 1) {
1409
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
1409
+ throw new Exception(SR_indexOutOfBounds + ((" (Parameter \'" + ((status_1 < 0) ? "index" : "count")) + "\')"));
1410
1410
  }
1411
1411
  return ys;
1412
1412
  }
@@ -1423,7 +1423,7 @@ export function updateAt<T>(index: int32, y: T, xs: FSharpList<T>): FSharpList<T
1423
1423
  }
1424
1424
  }, xs);
1425
1425
  if (!isDone) {
1426
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1426
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1427
1427
  }
1428
1428
  return ys;
1429
1429
  }
package/Seq.ts CHANGED
@@ -559,14 +559,14 @@ export function exactlyOne<T>(xs: Iterable<T>): T {
559
559
  if (e["System.Collections.IEnumerator.MoveNext"]()) {
560
560
  const v: T = e["System.Collections.Generic.IEnumerator`1.get_Current"]();
561
561
  if (e["System.Collections.IEnumerator.MoveNext"]()) {
562
- throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "source");
562
+ throw new Exception(SR_inputSequenceTooLong + " (Parameter \'source\')");
563
563
  }
564
564
  else {
565
565
  return v;
566
566
  }
567
567
  }
568
568
  else {
569
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
569
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
570
570
  }
571
571
  }
572
572
  finally {
@@ -764,7 +764,7 @@ export function tryHead<T>(xs: Iterable<T>): Option<T> {
764
764
  export function head<T>(xs: Iterable<T>): T {
765
765
  const matchValue: Option<T> = tryHead<T>(xs);
766
766
  if (matchValue == null) {
767
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
767
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
768
768
  }
769
769
  else {
770
770
  return value_1(matchValue);
@@ -836,7 +836,7 @@ export function tryItem<T>(index: int32, xs: Iterable<T>): Option<T> {
836
836
  export function item<T>(index: int32, xs: Iterable<T>): T {
837
837
  const matchValue: Option<T> = tryItem<T>(index, xs);
838
838
  if (matchValue == null) {
839
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
839
+ throw new Exception(SR_notEnoughElements + " (Parameter \'index\')");
840
840
  }
841
841
  else {
842
842
  return value_1(matchValue);
@@ -896,7 +896,7 @@ export function tryLast<T>(xs: Iterable<T>): Option<T> {
896
896
  export function last<T>(xs: Iterable<T>): T {
897
897
  const matchValue: Option<T> = tryLast<T>(xs);
898
898
  if (matchValue == null) {
899
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
899
+ throw new Exception(SR_notEnoughElements + " (Parameter \'source\')");
900
900
  }
901
901
  else {
902
902
  return value_1(matchValue);
@@ -1205,7 +1205,7 @@ export function skip<T>(count: int32, source: Iterable<T>): Iterable<T> {
1205
1205
  try {
1206
1206
  for (let _ = 1; _ <= count; _++) {
1207
1207
  if (!e["System.Collections.IEnumerator.MoveNext"]()) {
1208
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
1208
+ throw new Exception(SR_notEnoughElements + " (Parameter \'source\')");
1209
1209
  }
1210
1210
  }
1211
1211
  return Enumerator_enumerateThenFinally<T>((): void => {
@@ -1241,7 +1241,7 @@ export function take<T>(count: int32, xs: Iterable<T>): Iterable<T> {
1241
1241
  return some(e["System.Collections.Generic.IEnumerator`1.get_Current"]());
1242
1242
  }
1243
1243
  else {
1244
- throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
1244
+ throw new Exception(SR_notEnoughElements + " (Parameter \'source\')");
1245
1245
  }
1246
1246
  }
1247
1247
  else {
@@ -1351,7 +1351,7 @@ export function average<T>(xs: Iterable<T>, averager: any): T {
1351
1351
  return averager.Add(acc, x);
1352
1352
  }, averager.GetZero(), xs);
1353
1353
  if (count === 0) {
1354
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
1354
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
1355
1355
  }
1356
1356
  else {
1357
1357
  return averager.DivideByInt(total, count);
@@ -1365,7 +1365,7 @@ export function averageBy<T, U>(f: ((arg0: T) => U), xs: Iterable<T>, averager:
1365
1365
  return averager.Add(acc, f(x));
1366
1366
  }, averager.GetZero(), xs);
1367
1367
  if (count === 0) {
1368
- throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
1368
+ throw new Exception(SR_inputSequenceEmpty + " (Parameter \'source\')");
1369
1369
  }
1370
1370
  else {
1371
1371
  return averager.DivideByInt(total, count);
@@ -1383,7 +1383,7 @@ export function chunkBySize<T>(chunkSize: int32, xs: Iterable<T>): Iterable<Muta
1383
1383
  export function insertAt<T>(index: int32, y: T, xs: Iterable<T>): Iterable<T> {
1384
1384
  let isDone = false;
1385
1385
  if (index < 0) {
1386
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1386
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1387
1387
  }
1388
1388
  return generateIndexed<IEnumerator<T>, T>((): IEnumerator<T> => ofSeq<T>(xs), (i: int32, e: IEnumerator<T>): Option<T> => {
1389
1389
  if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
@@ -1395,7 +1395,7 @@ export function insertAt<T>(index: int32, y: T, xs: Iterable<T>): Iterable<T> {
1395
1395
  }
1396
1396
  else {
1397
1397
  if (!isDone) {
1398
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1398
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1399
1399
  }
1400
1400
  return undefined;
1401
1401
  }
@@ -1407,7 +1407,7 @@ export function insertAt<T>(index: int32, y: T, xs: Iterable<T>): Iterable<T> {
1407
1407
  export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: Iterable<T>): Iterable<T> {
1408
1408
  let status = -1;
1409
1409
  if (index < 0) {
1410
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1410
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1411
1411
  }
1412
1412
  return generateIndexed<[IEnumerator<T>, IEnumerator<T>], T>((): [IEnumerator<T>, IEnumerator<T>] => ([ofSeq<T>(xs), ofSeq<T>(ys)] as [IEnumerator<T>, IEnumerator<T>]), (i: int32, tupledArg: [IEnumerator<T>, IEnumerator<T>]): Option<T> => {
1413
1413
  const e1: IEnumerator<T> = tupledArg[0];
@@ -1434,7 +1434,7 @@ export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: Iterable<T>):
1434
1434
  }
1435
1435
  else {
1436
1436
  if (status < 1) {
1437
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1437
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1438
1438
  }
1439
1439
  return undefined;
1440
1440
  }
@@ -1451,7 +1451,7 @@ export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: Iterable<T>):
1451
1451
  export function removeAt<T>(index: int32, xs: Iterable<T>): Iterable<T> {
1452
1452
  let isDone = false;
1453
1453
  if (index < 0) {
1454
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1454
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1455
1455
  }
1456
1456
  return generateIndexed<IEnumerator<T>, T>((): IEnumerator<T> => ofSeq<T>(xs), (i: int32, e: IEnumerator<T>): Option<T> => {
1457
1457
  if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
@@ -1463,7 +1463,7 @@ export function removeAt<T>(index: int32, xs: Iterable<T>): Iterable<T> {
1463
1463
  }
1464
1464
  else {
1465
1465
  if (!isDone) {
1466
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1466
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1467
1467
  }
1468
1468
  return undefined;
1469
1469
  }
@@ -1474,7 +1474,7 @@ export function removeAt<T>(index: int32, xs: Iterable<T>): Iterable<T> {
1474
1474
 
1475
1475
  export function removeManyAt<T>(index: int32, count: int32, xs: Iterable<T>): Iterable<T> {
1476
1476
  if (index < 0) {
1477
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1477
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1478
1478
  }
1479
1479
  return generateIndexed<IEnumerator<T>, T>((): IEnumerator<T> => ofSeq<T>(xs), (i: int32, e: IEnumerator<T>): Option<T> => {
1480
1480
  if (i < index) {
@@ -1482,14 +1482,14 @@ export function removeManyAt<T>(index: int32, count: int32, xs: Iterable<T>): It
1482
1482
  return some(e["System.Collections.Generic.IEnumerator`1.get_Current"]());
1483
1483
  }
1484
1484
  else {
1485
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1485
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1486
1486
  }
1487
1487
  }
1488
1488
  else {
1489
1489
  if (i === index) {
1490
1490
  for (let _ = 1; _ <= count; _++) {
1491
1491
  if (!e["System.Collections.IEnumerator.MoveNext"]()) {
1492
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "count");
1492
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'count\')");
1493
1493
  }
1494
1494
  }
1495
1495
  }
@@ -1503,7 +1503,7 @@ export function removeManyAt<T>(index: int32, count: int32, xs: Iterable<T>): It
1503
1503
  export function updateAt<T>(index: int32, y: T, xs: Iterable<T>): Iterable<T> {
1504
1504
  let isDone = false;
1505
1505
  if (index < 0) {
1506
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1506
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1507
1507
  }
1508
1508
  return generateIndexed<IEnumerator<T>, T>((): IEnumerator<T> => ofSeq<T>(xs), (i: int32, e: IEnumerator<T>): Option<T> => {
1509
1509
  if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
@@ -1515,7 +1515,7 @@ export function updateAt<T>(index: int32, y: T, xs: Iterable<T>): Iterable<T> {
1515
1515
  }
1516
1516
  else {
1517
1517
  if (!isDone) {
1518
- throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1518
+ throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
1519
1519
  }
1520
1520
  return undefined;
1521
1521
  }
package/System.ts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { Exception } from "./Util.ts";
2
+ import { defaultOf, Exception } from "./Util.ts";
3
3
  import { class_type, TypeInfo } from "./Reflection.ts";
4
4
  import { SR_Arg_ArgumentOutOfRangeException, SR_ArgumentNull_Generic, SR_Arg_ArgumentException, SR_Arg_ParamName_Name, SR_Arg_TimeoutException, SR_Arg_StackOverflowException, SR_Arg_RankException, SR_Arg_OverflowException, SR_Arg_OutOfMemoryException, SR_Arg_NullReferenceException, SR_Arg_NotSupportedException, SR_Arg_NotImplementedException, SR_Arg_NotFiniteNumberException, SR_Arg_InvalidOperationException, SR_Arg_IndexOutOfRangeException, SR_Arg_FormatException, SR_Arg_DivideByZero, SR_Arg_ArithmeticException, SR_Arg_ApplicationException, SR_Arg_SystemException } from "./Global.ts";
5
5
  import { isNullOrEmpty } from "./String.ts";
@@ -294,8 +294,8 @@ export function TimeoutException_$ctor(): TimeoutException {
294
294
 
295
295
  export class ArgumentException extends Exception {
296
296
  readonly paramName: string;
297
- constructor(message: string, paramName: string) {
298
- super(isNullOrEmpty(paramName) ? message : (((message + SR_Arg_ParamName_Name) + paramName) + "\')"));
297
+ constructor(message: string, paramName: string, innerException: Exception) {
298
+ super(isNullOrEmpty(paramName) ? message : (((message + SR_Arg_ParamName_Name) + paramName) + "\')"), innerException);
299
299
  this.paramName = paramName;
300
300
  }
301
301
  }
@@ -304,16 +304,24 @@ export function ArgumentException_$reflection(): TypeInfo {
304
304
  return class_type("System.ArgumentException", undefined, ArgumentException, class_type("System.Exception"));
305
305
  }
306
306
 
307
- export function ArgumentException_$ctor_Z384F8060(message: string, paramName: string): ArgumentException {
308
- return new ArgumentException(message, paramName);
307
+ export function ArgumentException_$ctor_Z60A2B367(message: string, paramName: string, innerException: Exception): ArgumentException {
308
+ return new ArgumentException(message, paramName, innerException);
309
309
  }
310
310
 
311
311
  export function ArgumentException_$ctor(): ArgumentException {
312
- return ArgumentException_$ctor_Z384F8060(SR_Arg_ArgumentException, "");
312
+ return ArgumentException_$ctor_Z60A2B367(SR_Arg_ArgumentException, "", defaultOf());
313
313
  }
314
314
 
315
315
  export function ArgumentException_$ctor_Z721C83C5(message: string): ArgumentException {
316
- return ArgumentException_$ctor_Z384F8060(message, "");
316
+ return ArgumentException_$ctor_Z60A2B367(message, "", defaultOf());
317
+ }
318
+
319
+ export function ArgumentException_$ctor_Z384F8060(message: string, paramName: string): ArgumentException {
320
+ return ArgumentException_$ctor_Z60A2B367(message, paramName, defaultOf());
321
+ }
322
+
323
+ export function ArgumentException_$ctor_68CE3CA2(message: string, innerException: Exception): ArgumentException {
324
+ return ArgumentException_$ctor_Z60A2B367(message, "", innerException);
317
325
  }
318
326
 
319
327
  export function ArgumentException__get_ParamName(_: ArgumentException): string {
@@ -322,7 +330,7 @@ export function ArgumentException__get_ParamName(_: ArgumentException): string {
322
330
 
323
331
  export class ArgumentNullException extends ArgumentException {
324
332
  constructor(paramName: string, message: string) {
325
- super(message, paramName);
333
+ super(message, paramName, defaultOf());
326
334
  }
327
335
  }
328
336
 
@@ -344,7 +352,7 @@ export function ArgumentNullException_$ctor(): ArgumentNullException {
344
352
 
345
353
  export class ArgumentOutOfRangeException extends ArgumentException {
346
354
  constructor(paramName: string, message: string) {
347
- super(message, paramName);
355
+ super(message, paramName, defaultOf());
348
356
  }
349
357
  }
350
358
 
package/Util.ts CHANGED
@@ -80,9 +80,15 @@ export interface ICollection<T> extends IEnumerable<T> {
80
80
  export class Exception {
81
81
  public message: string;
82
82
  public stack?: string;
83
+ // Typed non-nullable to match how Fable models .NET reference types: nullability
84
+ // annotations are erased, so consumers (and `get_InnerException`) see `Exception`.
85
+ // At runtime this is `undefined` when no inner exception was provided, just like
86
+ // a `defaultOf()` value, which is fine for code that reads `.InnerException`.
87
+ public innerException!: Exception;
83
88
 
84
- constructor(msg?: string) {
89
+ constructor(msg?: string, innerException?: Exception) {
85
90
  this.message = msg ?? "";
91
+ this.innerException = innerException as Exception;
86
92
  }
87
93
 
88
94
  toString() {
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.1.1",
6
+ "version": "2.2.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",