feat(@jest/globals): add jest.Mocked, jest.MockedClass, jest.MockedFunction and jest.MockedObject utility types#12727
Conversation
|
exciting! |
|
@mrazauskas hiya! what's the state here? 🙂 Would love to land it for 29! |
|
This is shaping up! Do you think we should move changes in |
|
It is a good question: if there is a need to expose The only reason I see is that having
More over Perhaps all we need is My only problem with Also looking at What if we would skip adding |
|
It's useful if you use it as argument I think. function helper(thing: jest.Mocked<SomeType>) {
// ...
}Right? As for deep vs not deep - sounds like a separate PR from this? |
|
Right. For me it makes sense to keep Alright. Let’s split this PR (; |
jest.Mockedjest.Mocked, jest.MockedClass, jest.MockedFunction and jest.MockedObject utility types
|
@SimenB All done. Finally ;D |
|
🎉 |
| declare const jest: Jest; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-namespace | ||
| declare namespace jest { |
There was a problem hiding this comment.
I love that we're finally adding type-only jest.* exports now! 👍
Hopefully we'll be able to replace most of @types/jest soonish with this approach
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
From #12424 (comment)
Summary
This PR adds utility types
jest.Mocked,jest.MockedClass,jest.MockedFunctionandjest.MockedObjectto the Jest object.Test plan
Type tests are added.