Skip to content

[Bug]: Should Not Show Warning About esModuleInterop If module is node16 or nodenext #4266

@threeal

Description

@threeal

Version

29.1.2

Steps to reproduce

Modify the tsconfig.json file by setting module to node16 or nodenext and don't specify the esModuleInterop option. As of me, i'm using the following configuration:

{
  "include": ["src"],
  "exclude": ["**/*.test.*"],
  "compilerOptions": {
    "exactOptionalPropertyTypes": true,
    "strict": true,
    "module": "node16",
    "declaration": true,
    "outDir": "dist",
    "target": "es2022",
    "skipLibCheck": true
  }
}

Expected behavior

Should not show warning about a suggestion to set the esModuleInterop to true. As seen here, the esModuleInterop option defaults to true if module is node16 or nodenext, so not specifying esModuleInterop on node16 should behave the same as setting esModuleInterop to true.

Actual behavior

Got this warning, everything works fine though:

ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.

Debug log

...

Additional context

No response

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12600
  Binaries:
    Node: 21.6.0 - ~/.nvm/versions/node/v21.6.0/bin/node
    Yarn: 4.1.0 - /mnt/c/Program Files/nodejs/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v21.6.0/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions