diff --git a/types/pid-from-port/index.d.ts b/types/pid-from-port/index.d.ts new file mode 100644 index 0000000000..e2cbf97a47 --- /dev/null +++ b/types/pid-from-port/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for pid-from-port 1.1 +// Project: https://github.com/kevva/pid-from-port#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = pidFromPort; + +/** + * Get PID from a port + * @param port Port to lookup. + */ +declare function pidFromPort(port: number): Promise; + +declare namespace pidFromPort { + /** + * Get PIDs for a list of ports. + * @param ports Ports to lookup. + * @returns A `Promise` with the port as key and the PID as value. + */ + function all(ports: number[]): Promise>; + /** + * Get all PIDs from ports. + * @returns A `Promise` with the port as key and the PID as value. + */ + function list(): Promise>; +} diff --git a/types/pid-from-port/pid-from-port-tests.ts b/types/pid-from-port/pid-from-port-tests.ts new file mode 100644 index 0000000000..e3c6e7edca --- /dev/null +++ b/types/pid-from-port/pid-from-port-tests.ts @@ -0,0 +1,10 @@ +import pidFromPort = require('pid-from-port'); + +// $ExpectType Promise +pidFromPort(8080); + +// $ExpectType Promise> +pidFromPort.all([8080, 22]); + +// $ExpectType Promise> +pidFromPort.list(); diff --git a/types/pid-from-port/tsconfig.json b/types/pid-from-port/tsconfig.json new file mode 100644 index 0000000000..a1e39e81b9 --- /dev/null +++ b/types/pid-from-port/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pid-from-port-tests.ts" + ] +} diff --git a/types/pid-from-port/tslint.json b/types/pid-from-port/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pid-from-port/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }