Jest/TypeScript - unable to import type {Config} from 'jest' in jest.config.ts - Cannot find module 'jest' or its corresponding type declarations

Viewed 10

I'm following the official Jest docs advising you to set up your config file like this:

import type {Config} from 'jest';

const config: Config = {
  verbose: true,
};

export default config;

However, when I try to do that, "jest" is underlined in red and I can see the error message:

Cannot find module 'jest' or its corresponding type declarations.ts(2307)

I have the following related packes installed:

  • @types/jest
  • jest
  • ts-jest

As this is exactly what the official docs specify, what am I doing wrong?

0 Answers
Related