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

Could not find a declaration file for module '@serialport/bindings-interface'. #52

Open
rosek86 opened this issue Nov 17, 2023 · 2 comments

Comments

@rosek86
Copy link

rosek86 commented Nov 17, 2023

Hello,

I get the following error when I try to use serialport in esm, is it something that can be adjusted in @serialport/bindings-interface.

error TS7016: Could not find a declaration file for module '@serialport/bindings-interface'. '(...)/node_modules/@serialport/bindings-interface/dist/index-esm.mjs' implicitly has an 'any' type.
  There are types at '(...)/node_modules/@serialport/bindings-interface/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@serialport/bindings-interface' library may need to update its package.json or typings.

4 import { PortInfo } from '@serialport/bindings-interface';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NOTE: when I copy index.d.ts file to index-esm.d.mts the error disappears.

@Azq2
Copy link

Azq2 commented Apr 27, 2024

Same problem.

@reconbot Can you fix this?

@volkmarnissen
Copy link

I was not able to build the module after sync and npm install, that's why I was not able to create a pull request.
I hat issues with rollup

However, if you use bindings-interface in a ESM based project (packge.jscon -> "type": "module"
You will get errors like the above.

"Solution": I copied the dist-ts/index.s.ts file to dist/index.d.ts file and changed the export section to

  "exports": {
    "require": "./dist/index.js",
    "types": "./dist/index.d.ts",
    "default": "./dist/index-esm.mjs"
 },

The same needs to be done for bindings-mock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants