-
-
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
[Bug]: Interface 'JestImportMeta' incorrectly extends interface 'ImportMeta' #13199
Comments
PR welcome to align with |
Hmm, still an issue @mrazauskas
|
Hm.. Seems like this is just another issue with And here: But in |
I guess there's not much we can do here? We could possibly move our |
Trying my luck with DefinitelyTyped/DefinitelyTyped#62204 |
There is more DefinitelyTyped/DefinitelyTyped#62206 (got merged 🚀) |
I was able to remove the |
Thanks! I looked though quickly lots of interesting and useful details. For instance, it would be nice if |
@SimenB What did you had in mind here? Just to remove it? I just checked if That’s radical idea, I understand. Could work as a compromise for now. |
Nah, it should definitely be there, but it's annoying when the types clash. So I meant to move our own to a place it doesn't clash with the On our side, maybe we can do export interface JestImportMeta extends Omit<ImportMeta, 'jest'> {
jest: Jest;
} or something? |
Wait. I just checked again and it looks like after |
The missing part is here: DefinitelyTyped/DefinitelyTyped#62259 |
Ah nice! Would be awesome to align - makes it easier to make their types based on ours in the future 👍 |
@mrazauskas after that's released, can we add a type test here that we're compatible? import {jest as realJest} from '@jest/globals';
expectAssignable<typeof jest>(realJest); or something like that? Of course that will yell at us if we become stricter in the future, but I'd rather know and deal with that as the issues crop up |
All fixes of Try it out. As mentioned before the culprit now are Jest’s build-in types of No need to rush at all. Just leaving a note on progress (; |
I'm getting this error with latest
I fixed this by removing import { afterEach, beforeEach, expect, test } from '@jest/globals' |
does it work with https://github.com/facebook/jest/releases/tag/v29.1.0? |
I was playing with my reproduction. Error is gone with |
I can confirm this works for me also with |
Great, thanks! |
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. |
Version
29.0.1
Steps to reproduce
@types/jest@29.0.0
andjest@29.0.1
to a typescript projectjest.createMockFromModule
callExpected behavior
Don't see any error.
Actual behavior
Additional context
@types/jest
declares asfunction createMockFromModule<T>(moduleName: string): T;
while
@jest/environment
declares ascreateMockFromModule(moduleName: string): unknown;
Environment
The text was updated successfully, but these errors were encountered: