diff --git a/types/serialport/index.d.ts b/types/serialport/index.d.ts index af560f6ddc..b015182fdf 100644 --- a/types/serialport/index.d.ts +++ b/types/serialport/index.d.ts @@ -40,7 +40,7 @@ declare class SerialPort extends Stream.Duplex { static Binding: SerialPort.BaseBinding; - static list(): Promise; + static list(callback?: SerialPort.ListCallback): Promise; } declare namespace SerialPort { diff --git a/types/serialport/serialport-tests.ts b/types/serialport/serialport-tests.ts index 7b540c5e12..16cf2b6a70 100644 --- a/types/serialport/serialport-tests.ts +++ b/types/serialport/serialport-tests.ts @@ -126,3 +126,14 @@ function test_properties() { const isOpen: boolean = port.isOpen; const path: string = port.path; } + +function test_list_ports_promise() { + const ports = SerialPort + .list() + .then((ports: any) => {}) + .catch((err: Error) => {}); +} + +function test_list_ports_callback() { + const ports = SerialPort.list((error: Error, port: any[]) => {}); +}