forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): add readme to jest-types (jestjs#12791)
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# @jest/types | ||
|
||
This package contains shared types of Jest's packages. | ||
|
||
If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package: | ||
|
||
```ts | ||
import {describe, expect, it} from '@jest/globals'; | ||
|
||
describe('my tests', () => { | ||
it('works', () => { | ||
expect(1).toBe(1); | ||
}); | ||
}); | ||
``` | ||
|
||
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. | ||
|
||
Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box: | ||
|
||
```ts | ||
// jest.config.ts | ||
import {Config} from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
// some typed config | ||
}; | ||
|
||
export default config; | ||
``` |