typesafe-i18n
typesafe-i18n copied to clipboard
fix: TS1479 error
Fixes https://github.com/ivanhofer/typesafe-i18n/issues/756.
Key Change:
- Addition of
"type": "module"inpackage.json.
Issue Background:
- The problem arises due to TypeScript's reliance on the
package.jsontypefield to determine the module format (CommonJS or ECMAScript Module, ESM) of a project. - In the absence of the
typefield, TypeScript, along with Node.js, defaults to interpreting modules as CommonJS. This becomes an issue when dealing with.d.tsfiles, as they do not specify the module system (like.mjsor.cjswould). - 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!
Ivan Hofer passed away. Im not sure there is any one that can approve this PR
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