typesafe-i18n icon indicating copy to clipboard operation
typesafe-i18n copied to clipboard

fix: TS1479 error

Open dilame opened this issue 2 years ago • 2 comments

Fixes https://github.com/ivanhofer/typesafe-i18n/issues/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 https://github.com/ivanhofer/typesafe-i18n/issues/756.

Thank you for considering this pull request!

dilame avatar Dec 19 '23 03:12 dilame

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

oliverjohns avatar Jan 19 '24 18:01 oliverjohns

Actually, it's incorrect solution as well.

Read more here:

  • https://github.com/unjs/unbuild/issues/238
  • https://twitter.com/atcb/status/1634653474041503744
  • https://github.com/microsoft/TypeScript/issues/50466

timofei-iatsenko avatar Jan 22 '24 16:01 timofei-iatsenko