Skip to content

Commit e21468d

Browse files
authored
fix: export globals as values, not types (#9925)
1 parent c5f2fd7 commit e21468d

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Fixes
66

7+
- `[jest-globals]` Export globals as values, not types ([#9925](https://github.com/facebook/jest/pull/9925))
8+
79
### Chore & Maintenance
810

911
### Performance

packages/jest-globals/src/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ import importedExpect = require('expect');
99
import type {Jest} from '@jest/environment';
1010
import type {Global} from '@jest/types';
1111

12-
export declare type jest = Jest;
12+
export declare const jest: Jest;
1313

14-
export declare type expect = typeof importedExpect;
14+
export declare const expect: typeof importedExpect;
1515

16-
export declare type it = Global.GlobalAdditions['it'];
17-
export declare type test = Global.GlobalAdditions['test'];
18-
export declare type fit = Global.GlobalAdditions['fit'];
19-
export declare type xit = Global.GlobalAdditions['xit'];
20-
export declare type xtest = Global.GlobalAdditions['xtest'];
21-
export declare type describe = Global.GlobalAdditions['describe'];
22-
export declare type xdescribe = Global.GlobalAdditions['xdescribe'];
23-
export declare type fdescribe = Global.GlobalAdditions['fdescribe'];
24-
export declare type beforeAll = Global.GlobalAdditions['beforeAll'];
25-
export declare type beforeEach = Global.GlobalAdditions['beforeEach'];
26-
export declare type afterEach = Global.GlobalAdditions['afterEach'];
27-
export declare type afterAll = Global.GlobalAdditions['afterAll'];
16+
export declare const it: Global.GlobalAdditions['it'];
17+
export declare const test: Global.GlobalAdditions['test'];
18+
export declare const fit: Global.GlobalAdditions['fit'];
19+
export declare const xit: Global.GlobalAdditions['xit'];
20+
export declare const xtest: Global.GlobalAdditions['xtest'];
21+
export declare const describe: Global.GlobalAdditions['describe'];
22+
export declare const xdescribe: Global.GlobalAdditions['xdescribe'];
23+
export declare const fdescribe: Global.GlobalAdditions['fdescribe'];
24+
export declare const beforeAll: Global.GlobalAdditions['beforeAll'];
25+
export declare const beforeEach: Global.GlobalAdditions['beforeEach'];
26+
export declare const afterEach: Global.GlobalAdditions['afterEach'];
27+
export declare const afterAll: Global.GlobalAdditions['afterAll'];
2828

2929
throw new Error(
3030
'Do not import `@jest/globals` outside of the Jest test environment',

packages/jest-runtime/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ import Snapshot = require('jest-snapshot');
5454
import stripBOM = require('strip-bom');
5555

5656
interface JestGlobalsValues extends Global.TestFrameworkGlobals {
57-
jest: JestGlobals.jest;
58-
expect: JestGlobals.expect;
57+
jest: typeof JestGlobals.jest;
58+
expect: typeof JestGlobals.expect;
5959
}
6060

6161
type HasteMapOptions = {

0 commit comments

Comments
 (0)