diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 80957f32ad..dccf75ecfe 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -11,6 +11,7 @@ // Jamie Mason // Douglas Duteil // Ahn +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -201,6 +202,10 @@ declare namespace jest { type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any; + interface FunctionLike { + readonly name: string; + } + /** * Creates a test closure */ @@ -222,7 +227,8 @@ declare namespace jest { } interface Describe { - (name: string, fn: EmptyFunction): void; + // tslint:disable-next-line ban-types + (name: number | string | Function | FunctionLike, fn: EmptyFunction): void; only: Describe; skip: Describe; } diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index cc73b0b054..786dccb641 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -10,6 +10,10 @@ declare const $: any; // Tests based on the Jest website jest.unmock('../sum'); +class TestClass { } + +describe(TestClass, () => { }); + describe('sum', () => { it('adds 1 + 2 to equal 3', () => { const sum: (a: number, b: number) => number = require('../sum');