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

fix: TS1479 error #757

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: TS1479 error #757

wants to merge 1 commit into from

Conversation

dilame
Copy link

@dilame dilame commented Dec 19, 2023

Fixes #756.

Key Change:

  • Addition of "type": "module" in package.json.

Issue Background:

  • The problem arises due to TypeScript's reliance on the package.json type field to determine the module format (CommonJS or ECMAScript Module, ESM) of a project.
  • In the absence of the type field, TypeScript, along with Node.js, defaults to interpreting modules as CommonJS. This becomes an issue when dealing with .d.ts files, as they do not specify the module system (like .mjs or .cjs would).
  • Consequently, when an ESM is imported in such a scenario, TypeScript incorrectly assumes it to be a CommonJS module, leading to module resolution conflicts described in error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls #756.

Thank you for considering this pull request!

@oliverjohns
Copy link

Ivan Hofer passed away. Im not sure there is any one that can approve this PR

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

Successfully merging this pull request may close these issues.

error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls
3 participants