ts-fortress 7.0.2 → 7.0.3

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 (33) hide show
  1. package/package.json +25 -24
  2. package/src/brand/branded-number.test.mts +1 -1
  3. package/src/brand/branded-string.test.mts +1 -1
  4. package/src/other-types/literal.test.mts +3 -3
  5. package/src/other-types/map.test.mts +3 -3
  6. package/src/other-types/set.test.mts +5 -5
  7. package/src/other-types/template-literal.test.mts +1 -3
  8. package/src/predefined/brand/number/finite-number.test.mts +3 -3
  9. package/src/predefined/brand/number/int.test.mts +3 -3
  10. package/src/predefined/brand/number/int16.test.mts +1 -1
  11. package/src/predefined/brand/number/int32.test.mts +1 -1
  12. package/src/predefined/brand/number/non-negative-finite-number.test.mts +1 -1
  13. package/src/predefined/brand/number/non-zero-finite-number.test.mts +1 -1
  14. package/src/predefined/brand/number/non-zero-int.test.mts +1 -1
  15. package/src/predefined/brand/number/non-zero-safe-int.test.mts +1 -1
  16. package/src/predefined/brand/number/positive-finite-number.test.mts +1 -1
  17. package/src/predefined/brand/number/positive-int.test.mts +3 -3
  18. package/src/predefined/brand/number/positive-safe-int.test.mts +1 -1
  19. package/src/predefined/brand/number/safe-int.test.mts +1 -1
  20. package/src/predefined/brand/number/safe-uint.test.mts +1 -1
  21. package/src/predefined/brand/number/uint.test.mts +3 -3
  22. package/src/predefined/brand/number/uint16.test.mts +1 -1
  23. package/src/predefined/brand/number/uint32.test.mts +1 -1
  24. package/src/predefined/brand/string/iso-8601.test.mts +1 -1
  25. package/src/predefined/brand/string/json-string.test.mts +1 -1
  26. package/src/primitives/bigint.test.mts +21 -23
  27. package/src/primitives/boolean.test.mts +3 -3
  28. package/src/primitives/null.test.mts +4 -4
  29. package/src/primitives/number.test.mts +20 -20
  30. package/src/primitives/string.test.mts +21 -21
  31. package/src/primitives/symbol.test.mts +3 -3
  32. package/src/primitives/undefined.test.mts +4 -4
  33. package/src/record/merge-records.test.mts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-fortress",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript"
@@ -75,9 +75,9 @@
75
75
  "z:vitest:node": "pnpm run z:vitest --project='Node.js'"
76
76
  },
77
77
  "dependencies": {
78
- "@sindresorhus/is": "^7.2.0",
79
- "ts-data-forge": "^6.8.0",
80
- "ts-type-forge": "^2.3.1"
78
+ "@sindresorhus/is": "^8.0.0",
79
+ "ts-data-forge": "^6.9.0",
80
+ "ts-type-forge": "^2.4.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@rollup/plugin-replace": "6.0.3",
@@ -90,45 +90,46 @@
90
90
  "@semantic-release/github": "12.0.6",
91
91
  "@semantic-release/npm": "13.1.5",
92
92
  "@semantic-release/release-notes-generator": "14.1.0",
93
- "@types/node": "25.4.0",
94
- "@vitest/browser-playwright": "4.0.18",
95
- "@vitest/coverage-v8": "4.0.18",
96
- "@vitest/ui": "4.0.18",
97
- "conventional-changelog-conventionalcommits": "9.3.0",
98
- "cspell": "9.7.0",
93
+ "@types/node": "25.6.0",
94
+ "@vitest/browser-playwright": "4.1.4",
95
+ "@vitest/coverage-v8": "4.1.4",
96
+ "@vitest/ui": "4.1.4",
97
+ "conventional-changelog-conventionalcommits": "9.3.1",
98
+ "cspell": "10.0.0",
99
+ "dedent": "1.7.2",
99
100
  "eslint": "9.39.4",
100
101
  "eslint-config-typed": "4.7.4",
101
102
  "fast-glob": "3.3.3",
102
103
  "fp-ts": "2.16.11",
103
- "github-settings-as-code": "1.2.0",
104
+ "github-settings-as-code": "1.2.3",
104
105
  "io-ts": "2.2.22",
105
106
  "jiti": "2.6.1",
106
107
  "markdownlint": "0.40.0",
107
- "markdownlint-cli2": "0.21.0",
108
+ "markdownlint-cli2": "0.22.0",
108
109
  "npm-run-all2": "8.0.4",
109
- "playwright": "1.58.2",
110
- "prettier": "3.8.1",
110
+ "playwright": "1.59.1",
111
+ "prettier": "3.8.3",
111
112
  "prettier-plugin-organize-imports": "4.3.0",
112
113
  "prettier-plugin-packagejson": "3.0.2",
113
- "rollup": "4.59.0",
114
+ "rollup": "4.60.1",
114
115
  "semantic-release": "25.0.3",
115
- "ts-codemod-lib": "^2.1.1",
116
- "ts-repo-utils": "9.0.0",
116
+ "ts-codemod-lib": "^2.1.2",
117
+ "ts-repo-utils": "9.0.1",
117
118
  "tslib": "2.8.1",
118
119
  "tsx": "4.21.0",
119
- "typedoc": "0.28.17",
120
+ "typedoc": "0.28.19",
120
121
  "typedoc-github-theme": "0.4.0",
121
122
  "typescript": "5.9.3",
122
- "vite": "7.3.1",
123
- "vitest": "4.0.18",
123
+ "vite": "8.0.8",
124
+ "vitest": "4.1.4",
124
125
  "zod": "4.3.6"
125
126
  },
126
- "packageManager": "pnpm@10.32.1",
127
+ "packageManager": "pnpm@10.33.1",
127
128
  "engines": {
128
- "node": ">=20.11.0",
129
- "pnpm": ">=8.0.0"
129
+ "node": ">=22.12.0",
130
+ "pnpm": ">=9.0.0"
130
131
  },
131
132
  "volta": {
132
- "node": "25.2.1"
133
+ "node": "25.9.0"
133
134
  }
134
135
  }
@@ -98,7 +98,7 @@ describe('simpleBrandedNumber', () => {
98
98
  });
99
99
 
100
100
  test('throws for invalid values', () => {
101
- expect(() => userIdType.cast('invalid')).toThrowError('Error');
101
+ expect(() => userIdType.cast('invalid')).toThrow('Error');
102
102
  });
103
103
  });
104
104
 
@@ -100,7 +100,7 @@ describe('simpleBrandedString', () => {
100
100
  });
101
101
 
102
102
  test('throws for invalid values', () => {
103
- expect(() => userNameType.cast(123)).toThrowError('Error');
103
+ expect(() => userNameType.cast(123)).toThrow('Error');
104
104
  });
105
105
  });
106
106
 
@@ -161,7 +161,7 @@ describe(literal, () => {
161
161
  test('invalid value throws error', () => {
162
162
  const value: unknown = 'world';
163
163
 
164
- expect(() => hello.cast(value)).toThrowError(
164
+ expect(() => hello.cast(value)).toThrow(
165
165
  'Error: expected <"hello"> type but <string> type value "world" was passed.',
166
166
  );
167
167
  });
@@ -451,7 +451,7 @@ describe(literal, () => {
451
451
  test('falsy case', () => {
452
452
  const x: unknown = 123n;
453
453
 
454
- expect(() => targetType.cast(x)).toThrowError('Error');
454
+ expect(() => targetType.cast(x)).toThrow('Error');
455
455
  });
456
456
  });
457
457
 
@@ -594,7 +594,7 @@ describe(literal, () => {
594
594
  test('falsy case', () => {
595
595
  const x: unknown = false;
596
596
 
597
- expect(() => targetType.cast(x)).toThrowError('Error');
597
+ expect(() => targetType.cast(x)).toThrow('Error');
598
598
  });
599
599
  });
600
600
 
@@ -153,7 +153,7 @@ test('MapType cast() method', () => {
153
153
 
154
154
  // Invalid input - should throw
155
155
 
156
- expect(() => StringNumberMap.cast('not a map')).toThrowError(
156
+ expect(() => StringNumberMap.cast('not a map')).toThrow(
157
157
  'Error: expected <Map> type but <string> type value',
158
158
  );
159
159
  });
@@ -170,13 +170,13 @@ test('MapType assertIs() method', () => {
170
170
 
171
171
  expect(() => {
172
172
  assertIsStringNumberMap(validMap);
173
- }).not.toThrowError();
173
+ }).not.toThrow();
174
174
 
175
175
  // Invalid input - should throw
176
176
 
177
177
  expect(() => {
178
178
  assertIsStringNumberMap('not a map');
179
- }).toThrowError('Error: expected <Map> type but <string> type value');
179
+ }).toThrow('Error: expected <Map> type but <string> type value');
180
180
  });
181
181
 
182
182
  test('MapType with custom typeName', () => {
@@ -141,11 +141,11 @@ test('SetType cast() method', () => {
141
141
 
142
142
  // Invalid input - should throw
143
143
 
144
- expect(() => StringSet.cast('not a set')).toThrowError(
144
+ expect(() => StringSet.cast('not a set')).toThrow(
145
145
  'Error: expected <Set> type but <string> type value',
146
146
  );
147
147
 
148
- expect(() => StringSet.cast([])).toThrowError(
148
+ expect(() => StringSet.cast([])).toThrow(
149
149
  'Error: expected <Set> type but <object> type value',
150
150
  );
151
151
  });
@@ -161,17 +161,17 @@ test('SetType assertIs() method', () => {
161
161
 
162
162
  expect(() => {
163
163
  assertIsNumberSet(validSet);
164
- }).not.toThrowError();
164
+ }).not.toThrow();
165
165
 
166
166
  // Invalid input - should throw
167
167
 
168
168
  expect(() => {
169
169
  assertIsNumberSet('not a set');
170
- }).toThrowError('Error: expected <Set> type but <string> type value');
170
+ }).toThrow('Error: expected <Set> type but <string> type value');
171
171
 
172
172
  expect(() => {
173
173
  assertIsNumberSet([1, 2, 3]);
174
- }).toThrowError('Error: expected <Set> type but <object> type value');
174
+ }).toThrow('Error: expected <Set> type but <object> type value');
175
175
  });
176
176
 
177
177
  test('SetType with custom typeName', () => {
@@ -62,9 +62,7 @@ describe(templateLiteral, () => {
62
62
  });
63
63
 
64
64
  test('cast invalid value throws', () => {
65
- expect(() => PathString.cast('users')).toThrowError(
66
- 'expected <PathString>',
67
- );
65
+ expect(() => PathString.cast('users')).toThrow('expected <PathString>');
68
66
  });
69
67
  });
70
68
 
@@ -135,7 +135,7 @@ describe(finiteNumber, () => {
135
135
 
136
136
  expect(() => {
137
137
  assertIs(x);
138
- }).not.toThrowError();
138
+ }).not.toThrow();
139
139
  });
140
140
 
141
141
  test('falsy case', () => {
@@ -146,7 +146,7 @@ describe(finiteNumber, () => {
146
146
 
147
147
  expect(() => {
148
148
  assertIs(x);
149
- }).toThrowError('Error: expected <FiniteNumber> type');
149
+ }).toThrow('Error: expected <FiniteNumber> type');
150
150
  });
151
151
  });
152
152
 
@@ -160,7 +160,7 @@ describe(finiteNumber, () => {
160
160
  test('falsy case', () => {
161
161
  const x: unknown = 'invalid';
162
162
 
163
- expect(() => targetType.cast(x)).toThrowError('Error');
163
+ expect(() => targetType.cast(x)).toThrow('Error');
164
164
  });
165
165
  });
166
166
 
@@ -127,7 +127,7 @@ describe(int, () => {
127
127
 
128
128
  expect(() => {
129
129
  assertIs(x);
130
- }).not.toThrowError();
130
+ }).not.toThrow();
131
131
  });
132
132
 
133
133
  test('falsy case', () => {
@@ -138,7 +138,7 @@ describe(int, () => {
138
138
 
139
139
  expect(() => {
140
140
  assertIs(x);
141
- }).toThrowError('Error: expected <Int> type');
141
+ }).toThrow('Error: expected <Int> type');
142
142
  });
143
143
  });
144
144
 
@@ -152,7 +152,7 @@ describe(int, () => {
152
152
  test('falsy case', () => {
153
153
  const x: unknown = 'invalid';
154
154
 
155
- expect(() => targetType.cast(x)).toThrowError('Error');
155
+ expect(() => targetType.cast(x)).toThrow('Error');
156
156
  });
157
157
  });
158
158
 
@@ -110,7 +110,7 @@ describe(int16, () => {
110
110
  test('falsy case', () => {
111
111
  const x: unknown = 'invalid';
112
112
 
113
- expect(() => targetType.cast(x)).toThrowError('Error');
113
+ expect(() => targetType.cast(x)).toThrow('Error');
114
114
  });
115
115
  });
116
116
 
@@ -104,7 +104,7 @@ describe(int32, () => {
104
104
  test('falsy case', () => {
105
105
  const x: unknown = 'invalid';
106
106
 
107
- expect(() => targetType.cast(x)).toThrowError('Error');
107
+ expect(() => targetType.cast(x)).toThrow('Error');
108
108
  });
109
109
  });
110
110
 
@@ -116,7 +116,7 @@ describe(nonNegativeFiniteNumber, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -116,7 +116,7 @@ describe(nonZeroFiniteNumber, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -110,7 +110,7 @@ describe(nonZeroInt, () => {
110
110
  test('falsy case', () => {
111
111
  const x: unknown = 'invalid';
112
112
 
113
- expect(() => targetType.cast(x)).toThrowError('Error');
113
+ expect(() => targetType.cast(x)).toThrow('Error');
114
114
  });
115
115
  });
116
116
 
@@ -116,7 +116,7 @@ describe(nonZeroSafeInt, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -116,7 +116,7 @@ describe(positiveFiniteNumber, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -147,7 +147,7 @@ describe(positiveInt, () => {
147
147
 
148
148
  expect(() => {
149
149
  assertIs(x);
150
- }).not.toThrowError();
150
+ }).not.toThrow();
151
151
  });
152
152
 
153
153
  test('falsy case', () => {
@@ -158,7 +158,7 @@ describe(positiveInt, () => {
158
158
 
159
159
  expect(() => {
160
160
  assertIs(x);
161
- }).toThrowError('Error: expected <PositiveInt> type');
161
+ }).toThrow('Error: expected <PositiveInt> type');
162
162
  });
163
163
  });
164
164
 
@@ -172,7 +172,7 @@ describe(positiveInt, () => {
172
172
  test('falsy case', () => {
173
173
  const x: unknown = 'invalid';
174
174
 
175
- expect(() => targetType.cast(x)).toThrowError('Error');
175
+ expect(() => targetType.cast(x)).toThrow('Error');
176
176
  });
177
177
  });
178
178
 
@@ -114,7 +114,7 @@ describe(positiveSafeInt, () => {
114
114
  test('falsy case', () => {
115
115
  const x: unknown = 'invalid';
116
116
 
117
- expect(() => targetType.cast(x)).toThrowError('Error');
117
+ expect(() => targetType.cast(x)).toThrow('Error');
118
118
  });
119
119
  });
120
120
 
@@ -106,7 +106,7 @@ describe(safeInt, () => {
106
106
  test('falsy case', () => {
107
107
  const x: unknown = 'invalid';
108
108
 
109
- expect(() => targetType.cast(x)).toThrowError('Error');
109
+ expect(() => targetType.cast(x)).toThrow('Error');
110
110
  });
111
111
  });
112
112
 
@@ -116,7 +116,7 @@ describe(safeUint, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -147,7 +147,7 @@ describe(uint, () => {
147
147
 
148
148
  expect(() => {
149
149
  assertIs(x);
150
- }).not.toThrowError();
150
+ }).not.toThrow();
151
151
  });
152
152
 
153
153
  test('falsy case', () => {
@@ -158,7 +158,7 @@ describe(uint, () => {
158
158
 
159
159
  expect(() => {
160
160
  assertIs(x);
161
- }).toThrowError('Error: expected <Uint> type');
161
+ }).toThrow('Error: expected <Uint> type');
162
162
  });
163
163
  });
164
164
 
@@ -172,7 +172,7 @@ describe(uint, () => {
172
172
  test('falsy case', () => {
173
173
  const x: unknown = 'invalid';
174
174
 
175
- expect(() => targetType.cast(x)).toThrowError('Error');
175
+ expect(() => targetType.cast(x)).toThrow('Error');
176
176
  });
177
177
  });
178
178
 
@@ -116,7 +116,7 @@ describe(uint16, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -116,7 +116,7 @@ describe(uint32, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -166,7 +166,7 @@ describe(iso8601, () => {
166
166
 
167
167
  expect(baseType.fill(value)).toBe(value);
168
168
 
169
- expect(() => baseType.cast(value)).not.toThrowError();
169
+ expect(() => baseType.cast(value)).not.toThrow();
170
170
  });
171
171
 
172
172
  test('fill falls back to default for invalid values', () => {
@@ -65,6 +65,6 @@ describe(jsonString, () => {
65
65
  test('cast returns parsed string when valid, throws otherwise', () => {
66
66
  expect(baseType.cast('{"foo":1}')).toBe('{"foo":1}');
67
67
 
68
- expect(() => baseType.cast('invalid')).toThrowError('Error');
68
+ expect(() => baseType.cast('invalid')).toThrow('Error');
69
69
  });
70
70
  });
@@ -92,7 +92,7 @@ describe(bigint, () => {
92
92
 
93
93
  expect(() => {
94
94
  assertIs(x);
95
- }).not.toThrowError();
95
+ }).not.toThrow();
96
96
  });
97
97
 
98
98
  test('falsy case', () => {
@@ -102,7 +102,7 @@ describe(bigint, () => {
102
102
 
103
103
  expect(() => {
104
104
  assertIs(x);
105
- }).toThrowError('Error');
105
+ }).toThrow('Error');
106
106
  });
107
107
  });
108
108
 
@@ -116,7 +116,7 @@ describe(bigint, () => {
116
116
  test('falsy case', () => {
117
117
  const x: unknown = 'invalid';
118
118
 
119
- expect(() => targetType.cast(x)).toThrowError('Error');
119
+ expect(() => targetType.cast(x)).toThrow('Error');
120
120
  });
121
121
  });
122
122
 
@@ -150,7 +150,7 @@ describe('bigint with constraints', () => {
150
150
  });
151
151
 
152
152
  test('rejects invalid default value', () => {
153
- expect(() => bigint(5n, { gt: 5n })).toThrowError('gt = 5');
153
+ expect(() => bigint(5n, { gt: 5n })).toThrow('gt = 5');
154
154
  });
155
155
  });
156
156
 
@@ -168,7 +168,7 @@ describe('bigint with constraints', () => {
168
168
  });
169
169
 
170
170
  test('rejects invalid default value', () => {
171
- expect(() => bigint(4n, { gte: 5n })).toThrowError('gte = 5');
171
+ expect(() => bigint(4n, { gte: 5n })).toThrow('gte = 5');
172
172
  });
173
173
  });
174
174
 
@@ -184,7 +184,7 @@ describe('bigint with constraints', () => {
184
184
  });
185
185
 
186
186
  test('rejects invalid default value', () => {
187
- expect(() => bigint(4n, { min: 5n })).toThrowError('min = 5');
187
+ expect(() => bigint(4n, { min: 5n })).toThrow('min = 5');
188
188
  });
189
189
  });
190
190
 
@@ -202,7 +202,7 @@ describe('bigint with constraints', () => {
202
202
  });
203
203
 
204
204
  test('rejects invalid default value', () => {
205
- expect(() => bigint(5n, { lt: 5n })).toThrowError('lt = 5');
205
+ expect(() => bigint(5n, { lt: 5n })).toThrow('lt = 5');
206
206
  });
207
207
  });
208
208
 
@@ -220,7 +220,7 @@ describe('bigint with constraints', () => {
220
220
  });
221
221
 
222
222
  test('rejects invalid default value', () => {
223
- expect(() => bigint(6n, { lte: 5n })).toThrowError('lte = 5');
223
+ expect(() => bigint(6n, { lte: 5n })).toThrow('lte = 5');
224
224
  });
225
225
  });
226
226
 
@@ -238,7 +238,7 @@ describe('bigint with constraints', () => {
238
238
  });
239
239
 
240
240
  test('rejects invalid default value', () => {
241
- expect(() => bigint(6n, { max: 5n })).toThrowError('max = 5');
241
+ expect(() => bigint(6n, { max: 5n })).toThrow('max = 5');
242
242
  });
243
243
  });
244
244
 
@@ -259,7 +259,7 @@ describe('bigint with constraints', () => {
259
259
  expect(() =>
260
260
  // @ts-expect-error 0n is not > 0n when positive is true
261
261
  bigint(0n, { positive: true }),
262
- ).toThrowError('positive = true');
262
+ ).toThrow('positive = true');
263
263
  });
264
264
  });
265
265
 
@@ -280,7 +280,7 @@ describe('bigint with constraints', () => {
280
280
  expect(() =>
281
281
  // @ts-expect-error -1n is not >= 0n when nonNegative is true
282
282
  bigint(-1n, { nonNegative: true }),
283
- ).toThrowError('nonNegative = true');
283
+ ).toThrow('nonNegative = true');
284
284
  });
285
285
  });
286
286
 
@@ -301,7 +301,7 @@ describe('bigint with constraints', () => {
301
301
  expect(() =>
302
302
  // @ts-expect-error 0n is not < 0n when negative is true
303
303
  bigint(0n, { negative: true }),
304
- ).toThrowError('negative = true');
304
+ ).toThrow('negative = true');
305
305
  });
306
306
  });
307
307
 
@@ -322,7 +322,7 @@ describe('bigint with constraints', () => {
322
322
  expect(() =>
323
323
  // @ts-expect-error 1n is not <= 0n when nonPositive is true
324
324
  bigint(1n, { nonPositive: true }),
325
- ).toThrowError('nonPositive = true');
325
+ ).toThrow('nonPositive = true');
326
326
  });
327
327
  });
328
328
 
@@ -340,9 +340,7 @@ describe('bigint with constraints', () => {
340
340
  });
341
341
 
342
342
  test('rejects invalid default value', () => {
343
- expect(() => bigint(7n, { multipleOf: 3n })).toThrowError(
344
- 'multipleOf = 3',
345
- );
343
+ expect(() => bigint(7n, { multipleOf: 3n })).toThrow('multipleOf = 3');
346
344
  });
347
345
  });
348
346
 
@@ -360,7 +358,7 @@ describe('bigint with constraints', () => {
360
358
  });
361
359
 
362
360
  test('rejects invalid default value', () => {
363
- expect(() => bigint(9n, { step: 2n })).toThrowError('step = 2');
361
+ expect(() => bigint(9n, { step: 2n })).toThrow('step = 2');
364
362
  });
365
363
  });
366
364
 
@@ -379,7 +377,7 @@ describe('bigint with constraints', () => {
379
377
  });
380
378
 
381
379
  test('rejects invalid default value', () => {
382
- expect(() => bigint(1n, { gt: 1n, lt: 10n })).toThrowError('gt = 1');
380
+ expect(() => bigint(1n, { gt: 1n, lt: 10n })).toThrow('gt = 1');
383
381
  });
384
382
  });
385
383
 
@@ -399,7 +397,7 @@ describe('bigint with constraints', () => {
399
397
  });
400
398
 
401
399
  test('rejects invalid default value', () => {
402
- expect(() => bigint(4n, { gte: 5n, lte: 10n })).toThrowError('gte = 5');
400
+ expect(() => bigint(4n, { gte: 5n, lte: 10n })).toThrow('gte = 5');
403
401
  });
404
402
  });
405
403
 
@@ -419,9 +417,9 @@ describe('bigint with constraints', () => {
419
417
  });
420
418
 
421
419
  test('rejects invalid default value', () => {
422
- expect(() =>
423
- bigint(4n, { positive: true, multipleOf: 3n }),
424
- ).toThrowError('multipleOf = 3');
420
+ expect(() => bigint(4n, { positive: true, multipleOf: 3n })).toThrow(
421
+ 'multipleOf = 3',
422
+ );
425
423
  });
426
424
  });
427
425
 
@@ -449,7 +447,7 @@ describe('bigint with constraints', () => {
449
447
  test('rejects invalid default value', () => {
450
448
  expect(() =>
451
449
  bigint(12n, { nonNegative: true, max: 10n, step: 2n }),
452
- ).toThrowError('max = 10');
450
+ ).toThrow('max = 10');
453
451
  });
454
452
  });
455
453
  });
@@ -93,7 +93,7 @@ describe(boolean, () => {
93
93
 
94
94
  expect(() => {
95
95
  assertIs(x);
96
- }).not.toThrowError();
96
+ }).not.toThrow();
97
97
  });
98
98
 
99
99
  test('falsy case', () => {
@@ -104,7 +104,7 @@ describe(boolean, () => {
104
104
 
105
105
  expect(() => {
106
106
  assertIs(x);
107
- }).toThrowError('Error');
107
+ }).toThrow('Error');
108
108
  });
109
109
  });
110
110
 
@@ -118,7 +118,7 @@ describe(boolean, () => {
118
118
  test('falsy case', () => {
119
119
  const x: unknown = 'invalid';
120
120
 
121
- expect(() => targetType.cast(x)).toThrowError('Error');
121
+ expect(() => targetType.cast(x)).toThrow('Error');
122
122
  });
123
123
  });
124
124
 
@@ -60,7 +60,7 @@ describe('null type', () => {
60
60
 
61
61
  expect(() => {
62
62
  nullType.assertIs(value);
63
- }).not.toThrowError();
63
+ }).not.toThrow();
64
64
  });
65
65
 
66
66
  test('non-null throws', () => {
@@ -68,7 +68,7 @@ describe('null type', () => {
68
68
 
69
69
  expect(() => {
70
70
  nullType.assertIs(value);
71
- }).toThrowError(
71
+ }).toThrow(
72
72
  'Error: expected <null> type but <undefined> type value `undefined` was passed.',
73
73
  );
74
74
  });
@@ -86,7 +86,7 @@ describe('null type', () => {
86
86
  test('non-null throws error', () => {
87
87
  const value: unknown = undefined;
88
88
 
89
- expect(() => nullType.cast(value)).toThrowError(
89
+ expect(() => nullType.cast(value)).toThrow(
90
90
  'Error: expected <null> type but <undefined> type value `undefined` was passed.',
91
91
  );
92
92
  });
@@ -94,7 +94,7 @@ describe('null type', () => {
94
94
  test.each([0, '', false, undefined, 42, 'hello'])(
95
95
  'nullType.cast($0) should throw error',
96
96
  (value) => {
97
- expect(() => nullType.cast(value)).toThrowError(
97
+ expect(() => nullType.cast(value)).toThrow(
98
98
  /Error: expected <null> type but <(number|string|boolean|undefined)> type value/u,
99
99
  );
100
100
  },
@@ -74,7 +74,7 @@ describe(number, () => {
74
74
 
75
75
  expect(() => {
76
76
  assertIs(value);
77
- }).not.toThrowError();
77
+ }).not.toThrow();
78
78
  });
79
79
 
80
80
  test('invalid value throws', () => {
@@ -82,7 +82,7 @@ describe(number, () => {
82
82
 
83
83
  expect(() => {
84
84
  assertIs(value);
85
- }).toThrowError(/Error: expected <number> type/u);
85
+ }).toThrow(/Error: expected <number> type/u);
86
86
  });
87
87
  });
88
88
 
@@ -98,7 +98,7 @@ describe(number, () => {
98
98
  test('invalid value throws error', () => {
99
99
  const value: unknown = 'not a number';
100
100
 
101
- expect(() => num.cast(value)).toThrowError(
101
+ expect(() => num.cast(value)).toThrow(
102
102
  'Error: expected <number> type but <string> type value "not a number" was passed.',
103
103
  );
104
104
  });
@@ -108,7 +108,7 @@ describe(number, () => {
108
108
 
109
109
  const value: unknown = 'not a number';
110
110
 
111
- expect(() => numWithDefault.cast(value)).toThrowError(
111
+ expect(() => numWithDefault.cast(value)).toThrow(
112
112
  'Error: expected <number> type but <string> type value "not a number" was passed.',
113
113
  );
114
114
  });
@@ -220,7 +220,7 @@ describe('number with constraints', () => {
220
220
  });
221
221
 
222
222
  test('rejects invalid default value', () => {
223
- expect(() => number(5, { gt: 5 })).toThrowError('gt = 5');
223
+ expect(() => number(5, { gt: 5 })).toThrow('gt = 5');
224
224
  });
225
225
  });
226
226
 
@@ -238,7 +238,7 @@ describe('number with constraints', () => {
238
238
  });
239
239
 
240
240
  test('rejects invalid default value', () => {
241
- expect(() => number(4, { gte: 5 })).toThrowError('gte = 5');
241
+ expect(() => number(4, { gte: 5 })).toThrow('gte = 5');
242
242
  });
243
243
  });
244
244
 
@@ -254,7 +254,7 @@ describe('number with constraints', () => {
254
254
  });
255
255
 
256
256
  test('rejects invalid default value', () => {
257
- expect(() => number(4, { min: 5 })).toThrowError('min = 5');
257
+ expect(() => number(4, { min: 5 })).toThrow('min = 5');
258
258
  });
259
259
  });
260
260
 
@@ -272,7 +272,7 @@ describe('number with constraints', () => {
272
272
  });
273
273
 
274
274
  test('rejects invalid default value', () => {
275
- expect(() => number(5, { lt: 5 })).toThrowError('lt = 5');
275
+ expect(() => number(5, { lt: 5 })).toThrow('lt = 5');
276
276
  });
277
277
  });
278
278
 
@@ -290,7 +290,7 @@ describe('number with constraints', () => {
290
290
  });
291
291
 
292
292
  test('rejects invalid default value', () => {
293
- expect(() => number(6, { lte: 5 })).toThrowError('lte = 5');
293
+ expect(() => number(6, { lte: 5 })).toThrow('lte = 5');
294
294
  });
295
295
  });
296
296
 
@@ -308,7 +308,7 @@ describe('number with constraints', () => {
308
308
  });
309
309
 
310
310
  test('rejects invalid default value', () => {
311
- expect(() => number(6, { max: 5 })).toThrowError('max = 5');
311
+ expect(() => number(6, { max: 5 })).toThrow('max = 5');
312
312
  });
313
313
  });
314
314
 
@@ -329,7 +329,7 @@ describe('number with constraints', () => {
329
329
  expect(() =>
330
330
  // @ts-expect-error 0 is not > 0 when positive is true
331
331
  number(0, { positive: true }),
332
- ).toThrowError('positive = true');
332
+ ).toThrow('positive = true');
333
333
  });
334
334
  });
335
335
 
@@ -350,7 +350,7 @@ describe('number with constraints', () => {
350
350
  expect(() =>
351
351
  // @ts-expect-error -1 is not >= 0 when nonNegative is true
352
352
  number(-1, { nonNegative: true }),
353
- ).toThrowError('nonNegative = true');
353
+ ).toThrow('nonNegative = true');
354
354
  });
355
355
  });
356
356
 
@@ -371,7 +371,7 @@ describe('number with constraints', () => {
371
371
  expect(() =>
372
372
  // @ts-expect-error 0 is not < 0 when negative is true
373
373
  number(0, { negative: true }),
374
- ).toThrowError('negative = true');
374
+ ).toThrow('negative = true');
375
375
  });
376
376
  });
377
377
 
@@ -392,7 +392,7 @@ describe('number with constraints', () => {
392
392
  expect(() =>
393
393
  // @ts-expect-error 1 is not <= 0 when nonPositive is true
394
394
  number(1, { nonPositive: true }),
395
- ).toThrowError('nonPositive = true');
395
+ ).toThrow('nonPositive = true');
396
396
  });
397
397
  });
398
398
 
@@ -408,7 +408,7 @@ describe('number with constraints', () => {
408
408
  });
409
409
 
410
410
  test('rejects invalid default value', () => {
411
- expect(() => number(7, { multipleOf: 3 })).toThrowError('multipleOf = 3');
411
+ expect(() => number(7, { multipleOf: 3 })).toThrow('multipleOf = 3');
412
412
  });
413
413
  });
414
414
 
@@ -424,7 +424,7 @@ describe('number with constraints', () => {
424
424
  });
425
425
 
426
426
  test('rejects invalid default value', () => {
427
- expect(() => number(9, { step: 2 })).toThrowError('step = 2');
427
+ expect(() => number(9, { step: 2 })).toThrow('step = 2');
428
428
  });
429
429
  });
430
430
 
@@ -443,7 +443,7 @@ describe('number with constraints', () => {
443
443
  });
444
444
 
445
445
  test('rejects invalid default value', () => {
446
- expect(() => number(1, { gt: 1, lt: 10 })).toThrowError('gt = 1');
446
+ expect(() => number(1, { gt: 1, lt: 10 })).toThrow('gt = 1');
447
447
  });
448
448
  });
449
449
 
@@ -463,7 +463,7 @@ describe('number with constraints', () => {
463
463
  });
464
464
 
465
465
  test('rejects invalid default value', () => {
466
- expect(() => number(4, { gte: 5, lte: 10 })).toThrowError('gte = 5');
466
+ expect(() => number(4, { gte: 5, lte: 10 })).toThrow('gte = 5');
467
467
  });
468
468
  });
469
469
 
@@ -483,7 +483,7 @@ describe('number with constraints', () => {
483
483
  });
484
484
 
485
485
  test('rejects invalid default value', () => {
486
- expect(() => number(4, { positive: true, multipleOf: 3 })).toThrowError(
486
+ expect(() => number(4, { positive: true, multipleOf: 3 })).toThrow(
487
487
  'multipleOf = 3',
488
488
  );
489
489
  });
@@ -513,7 +513,7 @@ describe('number with constraints', () => {
513
513
  test('rejects invalid default value', () => {
514
514
  expect(() =>
515
515
  number(12, { nonNegative: true, max: 10, step: 2 }),
516
- ).toThrowError('max = 10');
516
+ ).toThrow('max = 10');
517
517
  });
518
518
  });
519
519
  });
@@ -79,7 +79,7 @@ describe(string, () => {
79
79
 
80
80
  expect(() => {
81
81
  assertIs(value);
82
- }).not.toThrowError();
82
+ }).not.toThrow();
83
83
  });
84
84
 
85
85
  test('invalid value throws', () => {
@@ -87,7 +87,7 @@ describe(string, () => {
87
87
 
88
88
  expect(() => {
89
89
  assertIs(value);
90
- }).toThrowError(/Error: expected <string> type/u);
90
+ }).toThrow(/Error: expected <string> type/u);
91
91
  });
92
92
  });
93
93
 
@@ -103,7 +103,7 @@ describe(string, () => {
103
103
  test('invalid value throws error', () => {
104
104
  const value: unknown = 42;
105
105
 
106
- expect(() => str.cast(value)).toThrowError(
106
+ expect(() => str.cast(value)).toThrow(
107
107
  'Error: expected <string> type but <number> type value `42` was passed.',
108
108
  );
109
109
  });
@@ -113,7 +113,7 @@ describe(string, () => {
113
113
 
114
114
  const value: unknown = 42;
115
115
 
116
- expect(() => strWithDefault.cast(value)).toThrowError(
116
+ expect(() => strWithDefault.cast(value)).toThrow(
117
117
  'Error: expected <string> type but <number> type value `42` was passed.',
118
118
  );
119
119
  });
@@ -248,7 +248,7 @@ describe('string with constraints', () => {
248
248
  expect(() =>
249
249
  // @ts-expect-error "cab" does not start with "ab"
250
250
  string('cab', { startsWith: 'ab' }),
251
- ).toThrowError('startsWith = ab');
251
+ ).toThrow('startsWith = ab');
252
252
  });
253
253
 
254
254
  test('empty startsWith', () => {
@@ -273,7 +273,7 @@ describe('string with constraints', () => {
273
273
  expect(() =>
274
274
  // @ts-expect-error "abc" does not end with "ba"
275
275
  string('abc', { endsWith: 'ba' }),
276
- ).toThrowError('endsWith = ba');
276
+ ).toThrow('endsWith = ba');
277
277
  });
278
278
 
279
279
  test('empty endsWith', () => {
@@ -298,7 +298,7 @@ describe('string with constraints', () => {
298
298
  expect(() =>
299
299
  // @ts-expect-error "abc" does not include "def"
300
300
  string('abc', { includes: 'def' }),
301
- ).toThrowError('includes = def');
301
+ ).toThrow('includes = def');
302
302
  });
303
303
 
304
304
  test('empty includes', () => {
@@ -321,7 +321,7 @@ describe('string with constraints', () => {
321
321
  expect(() =>
322
322
  // @ts-expect-error "ABCDEFGHI" is not assignable if lowercase is true
323
323
  string('ABCDEFGHI', { lowercase: true }),
324
- ).toThrowError('lowercase = true');
324
+ ).toThrow('lowercase = true');
325
325
  });
326
326
  });
327
327
 
@@ -340,7 +340,7 @@ describe('string with constraints', () => {
340
340
  expect(() =>
341
341
  // @ts-expect-error "abcdefghi" is not assignable if uppercase is true
342
342
  string('abcdefghi', { uppercase: true }),
343
- ).toThrowError('uppercase = true');
343
+ ).toThrow('uppercase = true');
344
344
  });
345
345
  });
346
346
 
@@ -359,7 +359,7 @@ describe('string with constraints', () => {
359
359
  expect(() =>
360
360
  // @ts-expect-error "" is not assignable if nonempty is true
361
361
  string('', { nonempty: true }),
362
- ).toThrowError('nonempty = true');
362
+ ).toThrow('nonempty = true');
363
363
  });
364
364
  });
365
365
 
@@ -378,7 +378,7 @@ describe('string with constraints', () => {
378
378
  expect(() =>
379
379
  // @ts-expect-error "hi" is not assignable if minLength is 3
380
380
  string('hi', { minLength: 3 }),
381
- ).toThrowError('minLength = 3');
381
+ ).toThrow('minLength = 3');
382
382
  });
383
383
 
384
384
  test('negative minLength', () => {
@@ -407,7 +407,7 @@ describe('string with constraints', () => {
407
407
  expect(() =>
408
408
  // @ts-expect-error "too-long" is not assignable if maxLength is 5
409
409
  string('too-long', { maxLength: 5 }),
410
- ).toThrowError('maxLength = 5');
410
+ ).toThrow('maxLength = 5');
411
411
  });
412
412
  });
413
413
 
@@ -427,7 +427,7 @@ describe('string with constraints', () => {
427
427
  test('rejects invalid default value', () => {
428
428
  const numeric = /^\d+$/u;
429
429
 
430
- expect(() => string('abc', { regex: numeric })).toThrowError(
430
+ expect(() => string('abc', { regex: numeric })).toThrow(
431
431
  String.raw`regex = ^\d+$`,
432
432
  );
433
433
  });
@@ -453,7 +453,7 @@ describe('string with constraints', () => {
453
453
  expect(() =>
454
454
  // @ts-expect-error "abba" does not end with "zz"
455
455
  string('abba', { startsWith: 'ab', endsWith: 'zz' }),
456
- ).toThrowError('endsWith = zz');
456
+ ).toThrow('endsWith = zz');
457
457
  });
458
458
  });
459
459
 
@@ -489,7 +489,7 @@ describe('string with constraints', () => {
489
489
  includes: 'cd',
490
490
  endsWith: 'hi',
491
491
  }),
492
- ).toThrowError('endsWith = hi');
492
+ ).toThrow('endsWith = hi');
493
493
 
494
494
  expect(() =>
495
495
  // @ts-expect-error "abcdhi" does not includes "cd"
@@ -498,7 +498,7 @@ describe('string with constraints', () => {
498
498
  includes: 'cd',
499
499
  endsWith: 'hi',
500
500
  }),
501
- ).toThrowError('includes = cd');
501
+ ).toThrow('includes = cd');
502
502
  });
503
503
  });
504
504
 
@@ -519,7 +519,7 @@ describe('string with constraints', () => {
519
519
  expect(() =>
520
520
  // @ts-expect-error "Ab" is neither strictly uppercase nor lowercase
521
521
  string('Ab', { uppercase: true, lowercase: true }),
522
- ).toThrowError('uppercase = true');
522
+ ).toThrow('uppercase = true');
523
523
  });
524
524
  });
525
525
 
@@ -550,7 +550,7 @@ describe('string with constraints', () => {
550
550
  minLength: 3,
551
551
  maxLength: 8,
552
552
  }),
553
- ).toThrowError(
553
+ ).toThrow(
554
554
  'defaultValue "extra-long-token" for string does not satisfy the constraint maxLength = 8',
555
555
  );
556
556
  });
@@ -563,7 +563,7 @@ describe('string with constraints', () => {
563
563
  minLength: 8,
564
564
  maxLength: 3,
565
565
  }),
566
- ).toThrowError(
566
+ ).toThrow(
567
567
  'defaultValue "1234" for string does not satisfy the constraint minLength = 8',
568
568
  );
569
569
  });
@@ -594,7 +594,7 @@ describe('string with constraints', () => {
594
594
 
595
595
  expect(() =>
596
596
  string('featureFLAG', { includes: 'feature', regex: slug }),
597
- ).toThrowError('regex = ^[a-z-]+$');
597
+ ).toThrow('regex = ^[a-z-]+$');
598
598
  });
599
599
  });
600
600
 
@@ -629,7 +629,7 @@ describe('string with constraints', () => {
629
629
  maxLength: 6,
630
630
  regex: digits,
631
631
  }),
632
- ).toThrowError('maxLength = 6');
632
+ ).toThrow('maxLength = 6');
633
633
  });
634
634
  });
635
635
  });
@@ -96,7 +96,7 @@ describe(symbol, () => {
96
96
 
97
97
  expect(() => {
98
98
  assertIs(x);
99
- }).not.toThrowError();
99
+ }).not.toThrow();
100
100
  });
101
101
 
102
102
  test('falsy case', () => {
@@ -106,7 +106,7 @@ describe(symbol, () => {
106
106
 
107
107
  expect(() => {
108
108
  assertIs(x);
109
- }).toThrowError('Error');
109
+ }).toThrow('Error');
110
110
  });
111
111
  });
112
112
 
@@ -122,7 +122,7 @@ describe(symbol, () => {
122
122
  test('falsy case', () => {
123
123
  const x: unknown = 'invalid';
124
124
 
125
- expect(() => targetType.cast(x)).toThrowError('Error');
125
+ expect(() => targetType.cast(x)).toThrow('Error');
126
126
  });
127
127
  });
128
128
 
@@ -58,7 +58,7 @@ describe('undefined type', () => {
58
58
 
59
59
  expect(() => {
60
60
  undefinedType.assertIs(value);
61
- }).not.toThrowError();
61
+ }).not.toThrow();
62
62
  });
63
63
 
64
64
  test('non-undefined throws', () => {
@@ -66,7 +66,7 @@ describe('undefined type', () => {
66
66
 
67
67
  expect(() => {
68
68
  undefinedType.assertIs(value);
69
- }).toThrowError(
69
+ }).toThrow(
70
70
  'Error: expected <undefined> type but <object> type value `null` was passed.',
71
71
  );
72
72
  });
@@ -86,7 +86,7 @@ describe('undefined type', () => {
86
86
 
87
87
  expect(() => {
88
88
  undefinedType.cast(value);
89
- }).toThrowError(
89
+ }).toThrow(
90
90
  'Error: expected <undefined> type but <object> type value `null` was passed.',
91
91
  );
92
92
  });
@@ -96,7 +96,7 @@ describe('undefined type', () => {
96
96
  (v) => {
97
97
  expect(() => {
98
98
  undefinedType.cast(v);
99
- }).toThrowError(
99
+ }).toThrow(
100
100
  /^Error: expected <undefined> type but <.*> type value .+\.$/u,
101
101
  );
102
102
  },
@@ -24,7 +24,7 @@ describe(mergeRecords, () => {
24
24
  expect(() => {
25
25
  // @ts-expect-error should pass record type
26
26
  mergeRecords([record({ x: number(), y: number() }), number()]);
27
- }).toThrowError(
27
+ }).toThrow(
28
28
  'Expected a record type but received a non-record type in mergeRecords',
29
29
  );
30
30
  });