diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index f649bee49e..d7fb0492a8 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -11,7 +11,8 @@ // Satana Charuwichitratana , // Erik Schierboom , // Bogdan Paranytsia , -// CXuesong +// CXuesong , +// Joey Kilpatrick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -103,7 +104,8 @@ declare namespace Chai { export interface ExpectStatic { (val: any, message?: string): Assertion; - fail(actual?: any, expected?: any, message?: string, operator?: Operator): void; + fail(message?: string): never; + fail(actual: any, expected: any, message?: string, operator?: Operator): never; } export interface AssertStatic extends Assert { @@ -167,7 +169,8 @@ declare namespace Chai { interface Should extends ShouldAssertion { not: ShouldAssertion; - fail(actual: any, expected: any, message?: string, operator?: Operator): void; + fail(message?: string): never; + fail(actual: any, expected: any, message?: string, operator?: Operator): never; } interface ShouldThrow { @@ -396,6 +399,14 @@ declare namespace Chai { */ (expression: any, message?: string): void; + /** + * Throws a failure. + * + * @param message Message to display on error. + * @remarks Node.js assert module-compatible. + */ + fail(message?: string): never; + /** * Throws a failure. * @@ -406,7 +417,7 @@ declare namespace Chai { * @param operator Comparison operator, if not strict equality. * @remarks Node.js assert module-compatible. */ - fail(actual?: T, expected?: T, message?: string, operator?: Operator): void; + fail(actual: T, expected: T, message?: string, operator?: Operator): never; /** * Asserts that object is truthy.