mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Add optional callback to SerialPort.list
This commit is contained in:
Vendored
+1
-1
@@ -40,7 +40,7 @@ declare class SerialPort extends Stream.Duplex {
|
||||
|
||||
static Binding: SerialPort.BaseBinding;
|
||||
|
||||
static list(): Promise<any>;
|
||||
static list(callback?: SerialPort.ListCallback): Promise<any>;
|
||||
}
|
||||
|
||||
declare namespace SerialPort {
|
||||
|
||||
@@ -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[]) => {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user