ts-data-forge 5.1.1 → 6.1.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.
Files changed (53) hide show
  1. package/dist/array/impl/array-utils-reducing-value.d.mts +28 -0
  2. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  3. package/dist/array/impl/array-utils-reducing-value.mjs +4 -1
  4. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  5. package/dist/array/impl/index.mjs +1 -1
  6. package/dist/collections/imap.d.mts +1 -1
  7. package/dist/collections/iset-mapped.d.mts +1 -1
  8. package/dist/collections/iset.d.mts +1 -1
  9. package/dist/guard/is-record.d.mts.map +1 -1
  10. package/dist/guard/is-record.mjs +1 -1
  11. package/dist/guard/is-record.mjs.map +1 -1
  12. package/package.json +52 -48
  13. package/src/array/impl/array-utils-overload-type-error.test.mts +4 -2
  14. package/src/array/impl/array-utils-reducing-value.mts +48 -0
  15. package/src/collections/imap.mts +1 -1
  16. package/src/collections/iset-mapped.mts +1 -1
  17. package/src/collections/iset.mts +1 -1
  18. package/src/functional/optional.test.mts +7 -5
  19. package/src/functional/result.test.mts +10 -8
  20. package/src/functional/ternary-result.test.mts +4 -4
  21. package/src/guard/has-key.test.mts +89 -186
  22. package/src/guard/is-record.mts +1 -2
  23. package/src/guard/is-record.test.mts +57 -67
  24. package/src/json/json.test.mts +5 -5
  25. package/src/number/branded-types/finite-number.test.mts +15 -11
  26. package/src/number/branded-types/int.test.mts +13 -13
  27. package/src/number/branded-types/int16.test.mts +15 -15
  28. package/src/number/branded-types/int32.test.mts +15 -15
  29. package/src/number/branded-types/non-negative-finite-number.test.mts +19 -15
  30. package/src/number/branded-types/non-negative-int16.test.mts +15 -15
  31. package/src/number/branded-types/non-negative-int32.test.mts +15 -15
  32. package/src/number/branded-types/non-zero-finite-number.test.mts +18 -18
  33. package/src/number/branded-types/non-zero-int.test.mts +18 -14
  34. package/src/number/branded-types/non-zero-int16.test.mts +19 -15
  35. package/src/number/branded-types/non-zero-int32.test.mts +19 -15
  36. package/src/number/branded-types/non-zero-safe-int.test.mts +22 -18
  37. package/src/number/branded-types/non-zero-uint16.test.mts +15 -15
  38. package/src/number/branded-types/non-zero-uint32.test.mts +15 -15
  39. package/src/number/branded-types/positive-finite-number.test.mts +18 -18
  40. package/src/number/branded-types/positive-int.test.mts +22 -16
  41. package/src/number/branded-types/positive-int16.test.mts +14 -14
  42. package/src/number/branded-types/positive-int32.test.mts +14 -14
  43. package/src/number/branded-types/positive-safe-int.test.mts +20 -18
  44. package/src/number/branded-types/positive-uint16.test.mts +15 -15
  45. package/src/number/branded-types/positive-uint32.test.mts +15 -15
  46. package/src/number/branded-types/safe-int.test.mts +21 -17
  47. package/src/number/branded-types/safe-uint.test.mts +22 -16
  48. package/src/number/branded-types/uint.test.mts +14 -14
  49. package/src/number/branded-types/uint16.test.mts +14 -14
  50. package/src/number/branded-types/uint32.test.mts +14 -14
  51. package/src/number/enum/int8.test.mts +1 -1
  52. package/src/number/enum/uint8.test.mts +1 -1
  53. package/src/others/memoize-function.test.mts +1 -0
@@ -9,45 +9,45 @@ import {
9
9
  describe('PositiveUint32 test', () => {
10
10
  describe(asPositiveUint32, () => {
11
11
  test('accepts valid positive uint32 values', () => {
12
- expect(() => asPositiveUint32(1)).not.toThrow();
12
+ expect(() => asPositiveUint32(1)).not.toThrowError();
13
13
 
14
- expect(() => asPositiveUint32(1000)).not.toThrow();
14
+ expect(() => asPositiveUint32(1000)).not.toThrowError();
15
15
 
16
- expect(() => asPositiveUint32(4_294_967_295)).not.toThrow(); // 2^32 - 1
16
+ expect(() => asPositiveUint32(4_294_967_295)).not.toThrowError(); // 2^32 - 1
17
17
 
18
- expect(() => asPositiveUint32(2_147_483_648)).not.toThrow(); // 2^31
18
+ expect(() => asPositiveUint32(2_147_483_648)).not.toThrowError(); // 2^31
19
19
  });
20
20
 
21
21
  test('rejects zero', () => {
22
- expect(() => asPositiveUint32(0)).toThrow(TypeError);
22
+ expect(() => asPositiveUint32(0)).toThrowError(TypeError);
23
23
  });
24
24
 
25
25
  test('rejects values outside uint32 range', () => {
26
- expect(() => asPositiveUint32(4_294_967_296)).toThrow(TypeError); // 2^32
26
+ expect(() => asPositiveUint32(4_294_967_296)).toThrowError(TypeError); // 2^32
27
27
 
28
- expect(() => asPositiveUint32(10_000_000_000)).toThrow(TypeError);
28
+ expect(() => asPositiveUint32(10_000_000_000)).toThrowError(TypeError);
29
29
  });
30
30
 
31
31
  test('rejects negative integers', () => {
32
- expect(() => asPositiveUint32(-1)).toThrow(TypeError);
32
+ expect(() => asPositiveUint32(-1)).toThrowError(TypeError);
33
33
 
34
- expect(() => asPositiveUint32(-42)).toThrow(TypeError);
34
+ expect(() => asPositiveUint32(-42)).toThrowError(TypeError);
35
35
  });
36
36
 
37
37
  test('rejects non-integers', () => {
38
- expect(() => asPositiveUint32(Number.NaN)).toThrow(TypeError);
38
+ expect(() => asPositiveUint32(Number.NaN)).toThrowError(TypeError);
39
39
 
40
- expect(() => asPositiveUint32(Number.POSITIVE_INFINITY)).toThrow(
40
+ expect(() => asPositiveUint32(Number.POSITIVE_INFINITY)).toThrowError(
41
41
  TypeError,
42
42
  );
43
43
 
44
- expect(() => asPositiveUint32(Number.NEGATIVE_INFINITY)).toThrow(
44
+ expect(() => asPositiveUint32(Number.NEGATIVE_INFINITY)).toThrowError(
45
45
  TypeError,
46
46
  );
47
47
 
48
- expect(() => asPositiveUint32(1.2)).toThrow(TypeError);
48
+ expect(() => asPositiveUint32(1.2)).toThrowError(TypeError);
49
49
 
50
- expect(() => asPositiveUint32(-3.4)).toThrow(TypeError);
50
+ expect(() => asPositiveUint32(-3.4)).toThrowError(TypeError);
51
51
  });
52
52
 
53
53
  test('returns the same value for valid inputs', () => {
@@ -70,7 +70,7 @@ describe('PositiveUint32 test', () => {
70
70
  ] as const)(
71
71
  `asPositiveUint32($name) should throw a TypeError`,
72
72
  ({ value }) => {
73
- expect(() => asPositiveUint32(value)).toThrow(
73
+ expect(() => asPositiveUint32(value)).toThrowError(
74
74
  new TypeError(
75
75
  `Expected a positive integer in [1, 2^32), got: ${value}`,
76
76
  ),
@@ -5,41 +5,45 @@ import { asSafeInt, SafeInt } from './safe-int.mjs';
5
5
  describe('SafeInt test', () => {
6
6
  describe(asSafeInt, () => {
7
7
  test('accepts valid safe integers', () => {
8
- expect(() => asSafeInt(0)).not.toThrow();
8
+ expect(() => asSafeInt(0)).not.toThrowError();
9
9
 
10
- expect(() => asSafeInt(1)).not.toThrow();
10
+ expect(() => asSafeInt(1)).not.toThrowError();
11
11
 
12
- expect(() => asSafeInt(-1)).not.toThrow();
12
+ expect(() => asSafeInt(-1)).not.toThrowError();
13
13
 
14
- expect(() => asSafeInt(42)).not.toThrow();
14
+ expect(() => asSafeInt(42)).not.toThrowError();
15
15
 
16
- expect(() => asSafeInt(-42)).not.toThrow();
16
+ expect(() => asSafeInt(-42)).not.toThrowError();
17
17
 
18
- expect(() => asSafeInt(Number.MAX_SAFE_INTEGER)).not.toThrow();
18
+ expect(() => asSafeInt(Number.MAX_SAFE_INTEGER)).not.toThrowError();
19
19
 
20
- expect(() => asSafeInt(Number.MIN_SAFE_INTEGER)).not.toThrow();
20
+ expect(() => asSafeInt(Number.MIN_SAFE_INTEGER)).not.toThrowError();
21
21
  });
22
22
 
23
23
  test('rejects values outside safe integer range', () => {
24
- expect(() => asSafeInt(Number.MAX_SAFE_INTEGER + 1)).toThrow(TypeError);
24
+ expect(() => asSafeInt(Number.MAX_SAFE_INTEGER + 1)).toThrowError(
25
+ TypeError,
26
+ );
25
27
 
26
- expect(() => asSafeInt(Number.MIN_SAFE_INTEGER - 1)).toThrow(TypeError);
28
+ expect(() => asSafeInt(Number.MIN_SAFE_INTEGER - 1)).toThrowError(
29
+ TypeError,
30
+ );
27
31
 
28
- expect(() => asSafeInt(Number.MAX_VALUE)).toThrow(TypeError);
32
+ expect(() => asSafeInt(Number.MAX_VALUE)).toThrowError(TypeError);
29
33
 
30
- expect(() => asSafeInt(-Number.MAX_VALUE)).toThrow(TypeError);
34
+ expect(() => asSafeInt(-Number.MAX_VALUE)).toThrowError(TypeError);
31
35
  });
32
36
 
33
37
  test('rejects non-integers', () => {
34
- expect(() => asSafeInt(Number.NaN)).toThrow(TypeError);
38
+ expect(() => asSafeInt(Number.NaN)).toThrowError(TypeError);
35
39
 
36
- expect(() => asSafeInt(Number.POSITIVE_INFINITY)).toThrow(TypeError);
40
+ expect(() => asSafeInt(Number.POSITIVE_INFINITY)).toThrowError(TypeError);
37
41
 
38
- expect(() => asSafeInt(Number.NEGATIVE_INFINITY)).toThrow(TypeError);
42
+ expect(() => asSafeInt(Number.NEGATIVE_INFINITY)).toThrowError(TypeError);
39
43
 
40
- expect(() => asSafeInt(1.2)).toThrow(TypeError);
44
+ expect(() => asSafeInt(1.2)).toThrowError(TypeError);
41
45
 
42
- expect(() => asSafeInt(-3.4)).toThrow(TypeError);
46
+ expect(() => asSafeInt(-3.4)).toThrowError(TypeError);
43
47
  });
44
48
 
45
49
  test('returns the same value for valid inputs', () => {
@@ -61,7 +65,7 @@ describe('SafeInt test', () => {
61
65
  { name: '1.2', value: 1.2 },
62
66
  { name: '-3.4', value: -3.4 },
63
67
  ] as const)(`asSafeInt($name) should throw a TypeError`, ({ value }) => {
64
- expect(() => asSafeInt(value)).toThrow(
68
+ expect(() => asSafeInt(value)).toThrowError(
65
69
  new TypeError(`Expected a safe integer, got: ${value}`),
66
70
  );
67
71
  });
@@ -5,41 +5,47 @@ import { asSafeUint, isSafeUint, SafeUint } from './safe-uint.mjs';
5
5
  describe('SafeUint test', () => {
6
6
  describe(asSafeUint, () => {
7
7
  test('accepts valid safe unsigned integers', () => {
8
- expect(() => asSafeUint(0)).not.toThrow();
8
+ expect(() => asSafeUint(0)).not.toThrowError();
9
9
 
10
- expect(() => asSafeUint(1)).not.toThrow();
10
+ expect(() => asSafeUint(1)).not.toThrowError();
11
11
 
12
- expect(() => asSafeUint(42)).not.toThrow();
12
+ expect(() => asSafeUint(42)).not.toThrowError();
13
13
 
14
- expect(() => asSafeUint(100)).not.toThrow();
14
+ expect(() => asSafeUint(100)).not.toThrowError();
15
15
 
16
- expect(() => asSafeUint(Number.MAX_SAFE_INTEGER)).not.toThrow();
16
+ expect(() => asSafeUint(Number.MAX_SAFE_INTEGER)).not.toThrowError();
17
17
  });
18
18
 
19
19
  test('rejects negative numbers', () => {
20
- expect(() => asSafeUint(-1)).toThrow(TypeError);
20
+ expect(() => asSafeUint(-1)).toThrowError(TypeError);
21
21
 
22
- expect(() => asSafeUint(-42)).toThrow(TypeError);
22
+ expect(() => asSafeUint(-42)).toThrowError(TypeError);
23
23
 
24
- expect(() => asSafeUint(Number.MIN_SAFE_INTEGER)).toThrow(TypeError);
24
+ expect(() => asSafeUint(Number.MIN_SAFE_INTEGER)).toThrowError(TypeError);
25
25
  });
26
26
 
27
27
  test('rejects values outside safe integer range', () => {
28
- expect(() => asSafeUint(Number.MAX_SAFE_INTEGER + 1)).toThrow(TypeError);
28
+ expect(() => asSafeUint(Number.MAX_SAFE_INTEGER + 1)).toThrowError(
29
+ TypeError,
30
+ );
29
31
 
30
- expect(() => asSafeUint(Number.MAX_VALUE)).toThrow(TypeError);
32
+ expect(() => asSafeUint(Number.MAX_VALUE)).toThrowError(TypeError);
31
33
  });
32
34
 
33
35
  test('rejects non-integers', () => {
34
- expect(() => asSafeUint(Number.NaN)).toThrow(TypeError);
36
+ expect(() => asSafeUint(Number.NaN)).toThrowError(TypeError);
35
37
 
36
- expect(() => asSafeUint(Number.POSITIVE_INFINITY)).toThrow(TypeError);
38
+ expect(() => asSafeUint(Number.POSITIVE_INFINITY)).toThrowError(
39
+ TypeError,
40
+ );
37
41
 
38
- expect(() => asSafeUint(Number.NEGATIVE_INFINITY)).toThrow(TypeError);
42
+ expect(() => asSafeUint(Number.NEGATIVE_INFINITY)).toThrowError(
43
+ TypeError,
44
+ );
39
45
 
40
- expect(() => asSafeUint(1.2)).toThrow(TypeError);
46
+ expect(() => asSafeUint(1.2)).toThrowError(TypeError);
41
47
 
42
- expect(() => asSafeUint(-3.4)).toThrow(TypeError);
48
+ expect(() => asSafeUint(-3.4)).toThrowError(TypeError);
43
49
  });
44
50
 
45
51
  test('returns the same value for valid inputs', () => {
@@ -60,7 +66,7 @@ describe('SafeUint test', () => {
60
66
  { name: '-3.4', value: -3.4 },
61
67
  { name: '-1', value: -1 },
62
68
  ] as const)(`asSafeUint($name) should throw a TypeError`, ({ value }) => {
63
- expect(() => asSafeUint(value)).toThrow(
69
+ expect(() => asSafeUint(value)).toThrowError(
64
70
  new TypeError(`Expected a non-negative safe integer, got: ${value}`),
65
71
  );
66
72
  });
@@ -5,35 +5,35 @@ import { asUint, isUint, Uint } from './uint.mjs';
5
5
  describe('Uint test', () => {
6
6
  describe(asUint, () => {
7
7
  test('accepts valid unsigned integers', () => {
8
- expect(() => asUint(0)).not.toThrow();
8
+ expect(() => asUint(0)).not.toThrowError();
9
9
 
10
- expect(() => asUint(1)).not.toThrow();
10
+ expect(() => asUint(1)).not.toThrowError();
11
11
 
12
- expect(() => asUint(42)).not.toThrow();
12
+ expect(() => asUint(42)).not.toThrowError();
13
13
 
14
- expect(() => asUint(100)).not.toThrow();
14
+ expect(() => asUint(100)).not.toThrowError();
15
15
 
16
- expect(() => asUint(Number.MAX_SAFE_INTEGER)).not.toThrow();
16
+ expect(() => asUint(Number.MAX_SAFE_INTEGER)).not.toThrowError();
17
17
  });
18
18
 
19
19
  test('rejects negative integers', () => {
20
- expect(() => asUint(-1)).toThrow(TypeError);
20
+ expect(() => asUint(-1)).toThrowError(TypeError);
21
21
 
22
- expect(() => asUint(-42)).toThrow(TypeError);
22
+ expect(() => asUint(-42)).toThrowError(TypeError);
23
23
 
24
- expect(() => asUint(Number.MIN_SAFE_INTEGER)).toThrow(TypeError);
24
+ expect(() => asUint(Number.MIN_SAFE_INTEGER)).toThrowError(TypeError);
25
25
  });
26
26
 
27
27
  test('rejects non-integers', () => {
28
- expect(() => asUint(Number.NaN)).toThrow(TypeError);
28
+ expect(() => asUint(Number.NaN)).toThrowError(TypeError);
29
29
 
30
- expect(() => asUint(Number.POSITIVE_INFINITY)).toThrow(TypeError);
30
+ expect(() => asUint(Number.POSITIVE_INFINITY)).toThrowError(TypeError);
31
31
 
32
- expect(() => asUint(Number.NEGATIVE_INFINITY)).toThrow(TypeError);
32
+ expect(() => asUint(Number.NEGATIVE_INFINITY)).toThrowError(TypeError);
33
33
 
34
- expect(() => asUint(1.2)).toThrow(TypeError);
34
+ expect(() => asUint(1.2)).toThrowError(TypeError);
35
35
 
36
- expect(() => asUint(-3.4)).toThrow(TypeError);
36
+ expect(() => asUint(-3.4)).toThrowError(TypeError);
37
37
  });
38
38
 
39
39
  test('returns the same value for valid inputs', () => {
@@ -52,7 +52,7 @@ describe('Uint test', () => {
52
52
  { name: '-3.4', value: -3.4 },
53
53
  { name: '-1', value: -1 },
54
54
  ] as const)(`asUint($name) should throw a TypeError`, ({ value }) => {
55
- expect(() => asUint(value)).toThrow(
55
+ expect(() => asUint(value)).toThrowError(
56
56
  new TypeError(`Expected a non-negative integer, got: ${value}`),
57
57
  );
58
58
  });
@@ -6,37 +6,37 @@ import { asUint16, isUint16, Uint16 } from './uint16.mjs';
6
6
  describe('Uint16 test', () => {
7
7
  describe(asUint16, () => {
8
8
  test('accepts valid uint16 values', () => {
9
- expect(() => asUint16(0)).not.toThrow();
9
+ expect(() => asUint16(0)).not.toThrowError();
10
10
 
11
- expect(() => asUint16(1)).not.toThrow();
11
+ expect(() => asUint16(1)).not.toThrowError();
12
12
 
13
- expect(() => asUint16(65_535)).not.toThrow(); // 2^16 - 1
13
+ expect(() => asUint16(65_535)).not.toThrowError(); // 2^16 - 1
14
14
 
15
- expect(() => asUint16(32_768)).not.toThrow(); // 2^15
15
+ expect(() => asUint16(32_768)).not.toThrowError(); // 2^15
16
16
  });
17
17
 
18
18
  test('rejects values outside uint16 range', () => {
19
- expect(() => asUint16(65_536)).toThrow(TypeError); // 2^16
19
+ expect(() => asUint16(65_536)).toThrowError(TypeError); // 2^16
20
20
 
21
- expect(() => asUint16(100_000)).toThrow(TypeError);
21
+ expect(() => asUint16(100_000)).toThrowError(TypeError);
22
22
  });
23
23
 
24
24
  test('rejects negative integers', () => {
25
- expect(() => asUint16(-1)).toThrow(TypeError);
25
+ expect(() => asUint16(-1)).toThrowError(TypeError);
26
26
 
27
- expect(() => asUint16(-42)).toThrow(TypeError);
27
+ expect(() => asUint16(-42)).toThrowError(TypeError);
28
28
  });
29
29
 
30
30
  test('rejects non-integers', () => {
31
- expect(() => asUint16(Number.NaN)).toThrow(TypeError);
31
+ expect(() => asUint16(Number.NaN)).toThrowError(TypeError);
32
32
 
33
- expect(() => asUint16(Number.POSITIVE_INFINITY)).toThrow(TypeError);
33
+ expect(() => asUint16(Number.POSITIVE_INFINITY)).toThrowError(TypeError);
34
34
 
35
- expect(() => asUint16(Number.NEGATIVE_INFINITY)).toThrow(TypeError);
35
+ expect(() => asUint16(Number.NEGATIVE_INFINITY)).toThrowError(TypeError);
36
36
 
37
- expect(() => asUint16(1.2)).toThrow(TypeError);
37
+ expect(() => asUint16(1.2)).toThrowError(TypeError);
38
38
 
39
- expect(() => asUint16(-3.4)).toThrow(TypeError);
39
+ expect(() => asUint16(-3.4)).toThrowError(TypeError);
40
40
  });
41
41
 
42
42
  test('returns the same value for valid inputs', () => {
@@ -55,7 +55,7 @@ describe('Uint16 test', () => {
55
55
  { name: '-3.4', value: -3.4 },
56
56
  { name: '-1', value: -1 },
57
57
  ] as const)(`asUint16($name) should throw a TypeError`, ({ value }) => {
58
- expect(() => asUint16(value)).toThrow(
58
+ expect(() => asUint16(value)).toThrowError(
59
59
  new TypeError(
60
60
  `Expected a non-negative integer less than 2^16, got: ${value}`,
61
61
  ),
@@ -6,37 +6,37 @@ import { asUint32, isUint32, Uint32 } from './uint32.mjs';
6
6
  describe('Uint32 test', () => {
7
7
  describe(asUint32, () => {
8
8
  test('accepts valid uint32 values', () => {
9
- expect(() => asUint32(0)).not.toThrow();
9
+ expect(() => asUint32(0)).not.toThrowError();
10
10
 
11
- expect(() => asUint32(1)).not.toThrow();
11
+ expect(() => asUint32(1)).not.toThrowError();
12
12
 
13
- expect(() => asUint32(4_294_967_295)).not.toThrow(); // 2^32 - 1
13
+ expect(() => asUint32(4_294_967_295)).not.toThrowError(); // 2^32 - 1
14
14
 
15
- expect(() => asUint32(2_147_483_648)).not.toThrow(); // 2^31
15
+ expect(() => asUint32(2_147_483_648)).not.toThrowError(); // 2^31
16
16
  });
17
17
 
18
18
  test('rejects values outside uint32 range', () => {
19
- expect(() => asUint32(4_294_967_296)).toThrow(TypeError); // 2^32
19
+ expect(() => asUint32(4_294_967_296)).toThrowError(TypeError); // 2^32
20
20
 
21
- expect(() => asUint32(10_000_000_000)).toThrow(TypeError);
21
+ expect(() => asUint32(10_000_000_000)).toThrowError(TypeError);
22
22
  });
23
23
 
24
24
  test('rejects negative integers', () => {
25
- expect(() => asUint32(-1)).toThrow(TypeError);
25
+ expect(() => asUint32(-1)).toThrowError(TypeError);
26
26
 
27
- expect(() => asUint32(-42)).toThrow(TypeError);
27
+ expect(() => asUint32(-42)).toThrowError(TypeError);
28
28
  });
29
29
 
30
30
  test('rejects non-integers', () => {
31
- expect(() => asUint32(Number.NaN)).toThrow(TypeError);
31
+ expect(() => asUint32(Number.NaN)).toThrowError(TypeError);
32
32
 
33
- expect(() => asUint32(Number.POSITIVE_INFINITY)).toThrow(TypeError);
33
+ expect(() => asUint32(Number.POSITIVE_INFINITY)).toThrowError(TypeError);
34
34
 
35
- expect(() => asUint32(Number.NEGATIVE_INFINITY)).toThrow(TypeError);
35
+ expect(() => asUint32(Number.NEGATIVE_INFINITY)).toThrowError(TypeError);
36
36
 
37
- expect(() => asUint32(1.2)).toThrow(TypeError);
37
+ expect(() => asUint32(1.2)).toThrowError(TypeError);
38
38
 
39
- expect(() => asUint32(-3.4)).toThrow(TypeError);
39
+ expect(() => asUint32(-3.4)).toThrowError(TypeError);
40
40
  });
41
41
 
42
42
  test('returns the same value for valid inputs', () => {
@@ -55,7 +55,7 @@ describe('Uint32 test', () => {
55
55
  { name: '-3.4', value: -3.4 },
56
56
  { name: '-1', value: -1 },
57
57
  ] as const)(`asUint32($name) should throw a TypeError`, ({ value }) => {
58
- expect(() => asUint32(value)).toThrow(
58
+ expect(() => asUint32(value)).toThrowError(
59
59
  new TypeError(
60
60
  `Expected a non-negative integer less than 2^32, got: ${value}`,
61
61
  ),
@@ -35,7 +35,7 @@ describe('Int8 test', () => {
35
35
  { value: Number.POSITIVE_INFINITY, name: 'Infinity' },
36
36
  { value: Number.NEGATIVE_INFINITY, name: '-Infinity' },
37
37
  ])('asInt8($name) should throw TypeError', ({ value }) => {
38
- expect(() => asInt8(value)).toThrow(TypeError);
38
+ expect(() => asInt8(value)).toThrowError(TypeError);
39
39
  });
40
40
  });
41
41
 
@@ -35,7 +35,7 @@ describe('Uint8 test', () => {
35
35
  { value: Number.POSITIVE_INFINITY, name: 'Infinity' },
36
36
  { value: Number.NEGATIVE_INFINITY, name: '-Infinity' },
37
37
  ])('asUint8($name) should throw TypeError', ({ value }) => {
38
- expect(() => asUint8(value)).toThrow(TypeError);
38
+ expect(() => asUint8(value)).toThrowError(TypeError);
39
39
  });
40
40
  });
41
41
 
@@ -51,6 +51,7 @@ describe(memoizeFunction, () => {
51
51
  expect(mockFn).toHaveBeenCalledOnce();
52
52
 
53
53
  // Should use cache even for undefined
54
+
54
55
  // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
55
56
  expect(memoized(5)).toBeUndefined();
56
57