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

Cannot import without esModuleInterop flag set to true #20

Closed
mgwidmann opened this issue Jun 5, 2023 · 0 comments
Closed

Cannot import without esModuleInterop flag set to true #20

mgwidmann opened this issue Jun 5, 2023 · 0 comments

Comments

@mgwidmann
Copy link

mgwidmann commented Jun 5, 2023

To get this package to work with Typescript, the following must be set to true in the tsconfig.json

{
  "compilerOptions": {
    "esModuleInterop": true
  }
}

Without this, in the latest Typescript (5.1.0), it fails compilation with the message:

error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

For libraries like https://github.com/aws/jsii they require that esModuleInterop be disabled so this library is unusable in that context.

For example, the following does not work:

import * as untildify from "untildify";

Neither does:

import untildify from "untildify";
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