-
-
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
[Feature]: support type inference for function parameters expect(someFunction).toBeCalledWith()
#13267
Comments
@mrazauskas can we do something clever here? |
Good idea. I think it should be possible to type |
@mrazauskas @SimenB |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
When using the following code:
The type expected as arguments for
toBeCalledWith
isany[]
This can be overridden by passing a type argument:
My proposal is to have it inferred automatically by default.
https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype
Similar methods should also be updated (e.g.
toHaveBeenCalledWith
,lastCalledWith
)Motivation
When using
toBeCalledWith
, users will get instant feedback and auto-completion for the arguments passed.Example
No response
Pitch
It will improve the DX of using jest.
The text was updated successfully, but these errors were encountered: