From a81f093aaa06b1bb2147c2b1ad9d3626d1da4ae9 Mon Sep 17 00:00:00 2001 From: Wolf Walter Date: Sun, 10 Jun 2018 09:45:16 +0200 Subject: [PATCH] [serialport] added readonly properties https://node-serialport.github.io/node-serialport/SerialPort.html --- types/serialport/index.d.ts | 5 +++++ types/serialport/serialport-tests.ts | 9 +++++++++ 2 files changed, 14 insertions(+) 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; +}