Skip to content

Incorrect typings of @serialport/bindings-cpp when using ESMΒ #2705

@CalmDownVal

Description

@CalmDownVal

SerialPort Version

12.0.1

Node Version

20.6.1

Electron Version

No response

Platform

macOS Ventura 13.4.1

Architecture

ARM

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

  • Install @serialport/bindings-cpp via Yarn Berry 3.6.3 with PnP
  • Use with TypeScript 5.2.2, set up with --module ESNext and --module-resolution bundler
  • Import the AutoDetectTypes type

What happens?

The type is reduced to any as TypeScript fails to load the BindingInterface type from @serialport/bindings-interface

What should have happened?

The type union should get correctly imported and not get reduced to any.

Additional information

I'm aware that Yarn PnP is an experimental feature, however that doesn't seem to be the cause, other modules work totally fine. It seems to be simply an out of date/incomplete package.json exports definition of the @serialport/bindings-interface package.

There is a pull request for the very package, soon about to celebrate its first birthday, that resolves this issue: serialport/bindings-interface#32

I'm opening this issue as the author of the mentioned PR seems to not have done so, or perhaps missed the readme asking to open issues here instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions