import type { Control } from '../../Control.js'; declare module '../../expect.js' { interface Validators { /** * Asserts that a function throws a given message and/or error class when * called. * * This validator does not support async functions. Use `toBeRejected` and * `toBeRejectedWith` instead. * * @param message - A substring of the error message or a regex matching the * message. * * @example * ```ts * // just checking that the function throws * expect(() => { * throw new Error('foo') * }).toThrow() * * // checking the error message with a substring * expect(() => { * throw new Error('no pancakes found') * }).toThrow('pancakes') * * // checking the error message with a regex * expect(() => { * throw new Error('12345') * }).toThrow(/^\d+$/) * * // checking the error class * expect(() => { * throw new TypeError('magic') * }).toThrow(TypeError) * * // checking the error class and message * expect(() => 1n / 0n).toThrow(RangeError, 'Division by zero') * ``` */ toThrow(this: Validators<() => any>, message?: string | RegExp): void; /** * Asserts that a function throws a given message and/or error class when * called. * * This validator does not support async functions. Use `toBeRejected` and * `toBeRejectedWith` instead. * * @param errorClass - The error class to check. * @param message - A substring of the error message or a regex matching the * message. * * @example * ```ts * // checking the error message with a substring * expect(() => { * throw new Error('no pancakes found') * }).toThrow('pancakes') * * // checking the error message with a regex * expect(() => { * throw new Error('12345') * }).toThrow(/^\d+$/) * * // checking the error class * expect(() => { * throw new TypeError('magic') * }).toThrow(TypeError) * * // checking the error class and message * expect(() => 1n / 0n).toThrow(RangeError, 'Division by zero') * ``` */ toThrow(this: Validators<() => any>, errorClass: new (...args: any[]) => Error, message?: string | RegExp): void; } } export declare function toThrow(control: Control, errorClassOrMessage?: (new (...args: any[]) => Error) | string | RegExp, message?: string | RegExp): void; //# sourceMappingURL=toThrow.d.ts.map