Uh oh!
There was an error while loading. Please reload this page.
fix: resolution of types from ESM - #58
Conversation
JulianWowra
commented
Jul 26, 2025
Look likes a duplicated of #32 with dirty fix? |
AlCalzone
commented
Jul 26, 2025
Not sure what you mean by dirty fix. This package is a CJS package. The .mjs file is faking ESM and is empty: https://github.com/arethetypeswrong/arethetypeswrong.github.io has good explanations for all possible kinds of import issue, but the general guideline is: don't lie about your package format. Both ESM and CJS code can import a CJS package just fine without the need for any tricks. |
volkmarnissen
commented
Oct 27, 2025
Yes, however, typescript build will fail for ESM. The same happens if you have a dependency serialport (bindings-interface) in typescript ESM based node project. |
AlCalzone
commented
Oct 27, 2025
In that case it's probably better to merge your PR instead. FWIW, I'm using this exact config with an ESM based project without issues. Maybe the |
While migrating a project that depends on this package to ESM, I noticed that the type definitions are wrong. They try to make the package look like it contains ESM definitions, but this doesn't actually work, as can be tested with https://arethetypeswrong.github.io/
Removing the incorrect definitions lets TypeScript detect what this package really is: CommonJS and nothing more.
Output of arethetypeswrong before this change:
Output of arethetypeswrong after this change: