diff --git a/types/serialport/index.d.ts b/types/serialport/index.d.ts index 84b5790fd4..b0a374efeb 100644 --- a/types/serialport/index.d.ts +++ b/types/serialport/index.d.ts @@ -12,6 +12,11 @@ declare class SerialPort extends Stream.Duplex { constructor(path: string, callback?: SerialPort.ErrorCallback); constructor(path: string, options?: SerialPort.OpenOptions, callback?: SerialPort.ErrorCallback); + readonly baudRate: number; + readonly binding: SerialPort.BaseBinding; + readonly isOpen: boolean; + readonly path: string; + open(callback?: SerialPort.ErrorCallback): void; update(options: SerialPort.UpdateOptions, callback?: SerialPort.ErrorCallback): void; diff --git a/types/serialport/serialport-tests.ts b/types/serialport/serialport-tests.ts index 9ff1daa26e..7b540c5e12 100644 --- a/types/serialport/serialport-tests.ts +++ b/types/serialport/serialport-tests.ts @@ -117,3 +117,12 @@ function test_parsers() { port.pipe(ReadyParser); port.pipe(RegexParser); } + +function test_properties() { + const port = new SerialPort(''); + + const baudRate: number = port.baudRate; + const binding: SerialPort.BaseBinding = port.binding; + const isOpen: boolean = port.isOpen; + const path: string = port.path; +}