Skip to content

Commit a5f29b4

Browse files
authored
docs: update the type removal notes (#15639)
1 parent 973c574 commit a5f29b4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/UpgradingToJest30.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,23 @@ const mockFs = jest.createMockFromModule('fs');
188188

189189
### Removed Mock Function Types
190190

191+
:::info
192+
193+
The type changes are only applicable if you explicitly import Jest APIs:
194+
195+
```ts
196+
import {expect, jest, test} from '@jest/globals';
197+
```
198+
199+
:::
200+
191201
Some TypeScript types related to mock functions have been removed from the public API.
192202

193203
- `MockFunctionMetadata`
194204
- `MockFunctionMetadataType`
195205
- `SpyInstance`
196206

197-
If you were using `jest.SpyInstance` in your TypeScript code (for instance, to annotate the return of `jest.spyOn`), you should update to using `jest.Mock` or the more specific `jest.MockedFunction` types.
198-
199-
:::note
200-
201-
These type removals do not affect runtime behavior – they are only relevant for TypeScript users. JavaScript users or tests will not notice any difference.
202-
203-
:::
207+
If you were using `jest.SpyInstance` (for instance, to annotate the return of `jest.spyOn`), you should update to using [`jest.Spied`](./MockFunctionAPI.md#jestspiedsource).
204208

205209
## Module & Runtime Changes
206210

0 commit comments

Comments
 (0)