diff --git a/packages/jest-types/src/Global.ts b/packages/jest-types/src/Global.ts index 0c2031cbb80a..46a4d0669b96 100644 --- a/packages/jest-types/src/Global.ts +++ b/packages/jest-types/src/Global.ts @@ -8,8 +8,8 @@ import type {CoverageMapData} from 'istanbul-lib-coverage'; export type ValidTestReturnValues = void | undefined; -type TestReturnValuePromise = Promise; -type TestReturnValueGenerator = Generator; +type TestReturnValuePromise = Promise; +type TestReturnValueGenerator = Generator; export type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; export type TestContext = Record; diff --git a/test-types/top-level-globals.test.ts b/test-types/top-level-globals.test.ts index 40dabbbe2142..cd019a976357 100644 --- a/test-types/top-level-globals.test.ts +++ b/test-types/top-level-globals.test.ts @@ -70,14 +70,18 @@ expectError(test(timeout, fn)); // wrong return value expectError(test(testName, () => 42)); -expectError(test(testName, async () => 42)); -// mixing done callback and promise +// mixing done callback and promise/generator expectError( test(testName, async done => { done(); }), ); +expectError( + test(testName, function* (done) { + done(); + }), +); expectType(test(testName, fn)); expectType(test(testName, asyncFn));