-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Type error on mockImplementation with call signature in object type #6155
Comments
Incase it helps narrow things down, we are also getting a bunch of similar typescript errors after upgrading from |
I think OP's @is-jonreeves If you are seeing a issue specific to 2.0.2 -> 2.0.3 (thus due to #6086), then it would be great if you can provide a reproduction. |
I tested For what it's worth... I re-tried downgrading to Downgrading to
Simplest example I could find in our code: const mockedSelectIsUnlicensed = vi.spyOn(sessionSlice, 'selectIsUnlicensed');
...
mockedSelectIsUnlicensed.mockImplementation(() => true); // <--- complains in 2.0.3 even though type is correct Type error in
I don't have a full example I can share, but if it helps, the usecase is a real |
Describe the bug
I have a function type with additional properties:
When I try to use
mockImplementation
on the call signature, I receive the following type errorThere was no error in v1. Now with v2, I have to pass the whole object even though
other
is not used and not working.I expect that only the call signature type is required for
mockImplementation
As additional help I found a helper to extract the call signature from an object type:
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-8ikkec?file=test%2Fbasic.test.ts&view=editor
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: