@@ -227,31 +227,31 @@ export interface ThrowsAssertion {
227227 /**
228228 * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
229229 */
230- ( fn : ( ) => any , expectations ?: null , message ?: string ) : any ;
230+ < ThrownError extends Error > ( fn : ( ) => any , expectations ?: null , message ?: string ) : ThrownError ;
231231
232232 /**
233233 * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
234234 * The error must be an instance of the given constructor.
235235 */
236- ( fn : ( ) => any , constructor : Constructor , message ?: string ) : any ;
236+ < ThrownError extends Error > ( fn : ( ) => any , constructor : Constructor , message ?: string ) : ThrownError ;
237237
238238 /**
239239 * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
240240 * The error must have a message that matches the regular expression.
241241 */
242- ( fn : ( ) => any , regex : RegExp , message ?: string ) : any ;
242+ < ThrownError extends Error > ( fn : ( ) => any , regex : RegExp , message ?: string ) : ThrownError ;
243243
244244 /**
245245 * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
246246 * The error must have a message equal to `errorMessage`.
247247 */
248- ( fn : ( ) => any , errorMessage : string , message ?: string ) : any ;
248+ < ThrownError extends Error > ( fn : ( ) => any , errorMessage : string , message ?: string ) : ThrownError ;
249249
250250 /**
251251 * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value.
252252 * The error must satisfy all expectations.
253253 */
254- ( fn : ( ) => any , expectations : ThrowsExpectation , message ?: string ) : any ;
254+ < ThrownError extends Error > ( fn : ( ) => any , expectations : ThrowsExpectation , message ?: string ) : ThrownError ;
255255
256256 /** Skip this assertion. */
257257 skip ( fn : ( ) => any , expectations ?: any , message ?: string ) : void ;
@@ -262,61 +262,61 @@ export interface ThrowsAsyncAssertion {
262262 * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
263263 * value. You must await the result.
264264 */
265- ( fn : ( ) => PromiseLike < any > , expectations ?: null , message ?: string ) : Promise < any > ;
265+ < ThrownError extends Error > ( fn : ( ) => PromiseLike < any > , expectations ?: null , message ?: string ) : Promise < ThrownError > ;
266266
267267 /**
268268 * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
269269 * value. You must await the result. The error must be an instance of the given constructor.
270270 */
271- ( fn : ( ) => PromiseLike < any > , constructor : Constructor , message ?: string ) : Promise < any > ;
271+ < ThrownError extends Error > ( fn : ( ) => PromiseLike < any > , constructor : Constructor , message ?: string ) : Promise < ThrownError > ;
272272
273273 /**
274274 * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
275275 * value. You must await the result. The error must have a message that matches the regular expression.
276276 */
277- ( fn : ( ) => PromiseLike < any > , regex : RegExp , message ?: string ) : Promise < any > ;
277+ < ThrownError extends Error > ( fn : ( ) => PromiseLike < any > , regex : RegExp , message ?: string ) : Promise < ThrownError > ;
278278
279279 /**
280280 * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
281281 * value. You must await the result. The error must have a message equal to `errorMessage`.
282282 */
283- ( fn : ( ) => PromiseLike < any > , errorMessage : string , message ?: string ) : Promise < any > ;
283+ < ThrownError extends Error > ( fn : ( ) => PromiseLike < any > , errorMessage : string , message ?: string ) : Promise < ThrownError > ;
284284
285285 /**
286286 * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error
287287 * value. You must await the result. The error must satisfy all expectations.
288288 */
289- ( fn : ( ) => PromiseLike < any > , expectations : ThrowsExpectation , message ?: string ) : Promise < any > ;
289+ < ThrownError extends Error > ( fn : ( ) => PromiseLike < any > , expectations : ThrowsExpectation , message ?: string ) : Promise < ThrownError > ;
290290
291291 /**
292292 * Assert that the promise rejects with [an error](https://www.npmjs.com/package/is-error). If so, returns the
293293 * rejection reason. You must await the result.
294294 */
295- ( promise : PromiseLike < any > , expectations ?: null , message ?: string ) : Promise < any > ;
295+ < ThrownError extends Error > ( promise : PromiseLike < any > , expectations ?: null , message ?: string ) : Promise < ThrownError > ;
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. You must await the result. The error must be an instance of the given constructor.
300300 */
301- ( promise : PromiseLike < any > , constructor : Constructor , message ?: string ) : Promise < any > ;
301+ < ThrownError extends Error > ( promise : PromiseLike < any > , constructor : Constructor , message ?: string ) : Promise < ThrownError > ;
302302
303303 /**
304304 * Assert that the promise rejects with [an error](https://www.npmjs.com/package/is-error). If so, returns the
305305 * rejection reason. You must await the result. The error must have a message that matches the regular expression.
306306 */
307- ( promise : PromiseLike < any > , regex : RegExp , message ?: string ) : Promise < any > ;
307+ < ThrownError extends Error > ( promise : PromiseLike < any > , regex : RegExp , message ?: string ) : Promise < ThrownError > ;
308308
309309 /**
310310 * Assert that the promise rejects with [an error](https://www.npmjs.com/package/is-error). If so, returns the
311311 * rejection reason. You must await the result. The error must have a message equal to `errorMessage`.
312312 */
313- ( promise : PromiseLike < any > , errorMessage : string , message ?: string ) : Promise < any > ;
313+ < ThrownError extends Error > ( promise : PromiseLike < any > , errorMessage : string , message ?: string ) : Promise < ThrownError > ;
314314
315315 /**
316316 * Assert that the promise rejects with [an error](https://www.npmjs.com/package/is-error). If so, returns the
317317 * rejection reason. You must await the result. The error must satisfy all expectations.
318318 */
319- ( promise : PromiseLike < any > , expectations : ThrowsExpectation , message ?: string ) : Promise < any > ;
319+ < ThrownError extends Error > ( promise : PromiseLike < any > , expectations : ThrowsExpectation , message ?: string ) : Promise < ThrownError > ;
320320
321321 /** Skip this assertion. */
322322 skip ( thrower : any , expectations ?: any , message ?: string ) : void ;
0 commit comments