1 | # @jest/types
|
2 |
|
3 | This package contains shared types of Jest's packages.
|
4 |
|
5 | If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package:
|
6 |
|
7 | ```ts
|
8 | import {describe, expect, it} from '@jest/globals';
|
9 |
|
10 | describe('my tests', () => {
|
11 | it('works', () => {
|
12 | expect(1).toBe(1);
|
13 | });
|
14 | });
|
15 | ```
|
16 |
|
17 | If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features.
|
18 |
|
19 | Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box:
|
20 |
|
21 | ```ts
|
22 | // jest.config.ts
|
23 | import {Config} from '@jest/types';
|
24 |
|
25 | const config: Config.InitialOptions = {
|
26 | // some typed config
|
27 | };
|
28 |
|
29 | export default config;
|
30 | ```
|