Skip to content

Error with @serialport/stream/dist/index.d.ts #2566

@AndrewLuGit

Description

@AndrewLuGit

SerialPort Version

10.5.0

Node Version

v16.16.0

Electron Version

No response

Platform

Microsoft Windows NT 10.0.22621.0 x64

Architecture

No response

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

I am working on a VSCode extension. The error occurs when trying to run the extension.

What happens?

I get this error:

node_modules/@serialport/stream/dist/index.d.ts:100:5 - error TS2416: Property '_write' in type 'SerialPortStream<T>' is not assignable to the same property in base type 'Duplex'.
  Type '(data: Buffer, encoding: BufferEncoding | undefined, callback: (error: Error | null) => void) => void' is not assignable to type '(chunk: any, encoding: string, callback: (error?: Error | null | undefined) => void) => void'.
    Types of parameters 'encoding' and 'encoding' are incompatible.
      Type 'string' is not assignable to type 'BufferEncoding | undefined'.

100     _write(data: Buffer, encoding: BufferEncoding | undefined, callback: (error: Error | null) => void): void;

What should have happened?

It shouldn't have gotten this error? If I manually change the line in the file to _write(data: Buffer, encoding: BufferEncoding, callback: (error: Error | null) => void): void;, it runs fine.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions