Skip to content

[Bug]: esModuleInterop: true without allowSyntheticDefaultImports: true is not the same #4156

Description

@simonhaenisch

Version

29.0.3

Steps to reproduce

Have a tsconfig.json with "esModuleInterop": true but without "allowSyntheticDefaultImports": true.

Expected behavior

Only having esModuleInterop enabled behaves exactly the same as having both options enabled, because the docs for esModuleInterop say:

Emit additional JavaScript to ease support for importing CommonJS modules. This enables allowSyntheticDefaultImports for type compatibility.

See more: https://www.typescriptlang.org/tsconfig#esModuleInterop

Actual behavior

It's not the same. I encountered an error (TS2589: Type instantiation is excessively deep and possibly infinite) in my IDE but not when running the tests. Once I added

"allowSyntheticDefaultImports": true

to tsconfig.json, I would see the same error during the test run as well.

Debug log

Don't have one

Additional context

No response

Environment

System:
    OS: macOS 13.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
    Node: 18.16.0 - /usr/local/opt/node@18/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.2 - /usr/local/bin/npm

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions