-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.Mocked
jest.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo!
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.MockedFunction
andjest.MockedObject
to the Jest object.Test plan
Type tests are added.