Skip to content
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

Typescript error when using @jest/globals #115

Open
dan2kx opened this issue Mar 29, 2023 · 0 comments
Open

Typescript error when using @jest/globals #115

dan2kx opened this issue Mar 29, 2023 · 0 comments

Comments

@dan2kx
Copy link

dan2kx commented Mar 29, 2023

node_modules/jest-mock-extended/lib/Mock.d.ts:13:61 - error TS2503: Cannot find namespace 'jest'.

13 export interface CalledWithMock<T, Y extends any[]> extends jest.Mock<T, Y> {
                                                               ~~~~

node_modules/jest-mock-extended/lib/Mock.d.ts:14:57 - error TS2503: Cannot find namespace 'jest'.

14     calledWith: (...args: Y | MatchersOrLiterals<Y>) => jest.Mock<T, Y>;
                                                           ~~~~

I think maybe jest needs to be imported from @jest/globals instead of using @types/jest which also throws an error if i install the latest version 29.5.0 to my project

node_modules/@jest/environment/build/index.d.ts:365:26 - error TS2430: Interface 'JestImportMeta' incorrectly extends interface 'ImportMeta'.
  Types of property 'jest' are incompatible.
    Type 'Jest' is missing the following properties from type 'typeof jest': runAllTimersAsync, runOnlyPendingTimersAsync, advanceTimersByTimeAsync, advanceTimersToNextTimerAsync

365 export declare interface JestImportMeta extends ImportMeta {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant