Skip to content

Commit b237d33

Browse files
committed
Update type definitions to disallow null throws expectations
The implemenation already fails the assertion when null is provided.
1 parent dd997f8 commit b237d33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

types/assertions.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export interface ThrowsAssertion {
281281
* Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
282282
* The error must satisfy all expectations. Returns null when the assertion fails.
283283
*/
284-
<ThrownError extends Error>(fn: () => any, expectations?: ThrowsExpectation | null, message?: string): ThrownError | null;
284+
<ThrownError extends Error>(fn: () => any, expectations?: ThrowsExpectation, message?: string): ThrownError | null;
285285

286286
/** Skip this assertion. */
287287
skip(fn: () => any, expectations?: any, message?: string): void;
@@ -292,14 +292,14 @@ export interface ThrowsAsyncAssertion {
292292
* Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
293293
* value. Returns null when the assertion fails. You must await the result. The error must satisfy all expectations.
294294
*/
295-
<ThrownError extends Error>(fn: () => PromiseLike<any>, expectations?: ThrowsExpectation | null, message?: string): Promise<ThrownError | null>;
295+
<ThrownError extends Error>(fn: () => PromiseLike<any>, expectations?: ThrowsExpectation, message?: string): Promise<ThrownError | null>;
296296

297297
/**
298298
* Assert that the promise rejects with [an error](https://www.npmjs.com/package/is-error). If so, returns the
299299
* rejection reason. Returns null when the assertion fails. You must await the result. The error must satisfy all
300300
* expectations.
301301
*/
302-
<ThrownError extends Error>(promise: PromiseLike<any>, expectations?: ThrowsExpectation | null, message?: string): Promise<ThrownError | null>; // eslint-disable-line @typescript-eslint/unified-signatures
302+
<ThrownError extends Error>(promise: PromiseLike<any>, expectations?: ThrowsExpectation, message?: string): Promise<ThrownError | null>; // eslint-disable-line @typescript-eslint/unified-signatures
303303

304304
/** Skip this assertion. */
305305
skip(thrower: any, expectations?: any, message?: string): void;

0 commit comments

Comments
 (0)