diff --git a/types/ps-tree/index.d.ts b/types/ps-tree/index.d.ts new file mode 100644 index 0000000000..ff60b6241e --- /dev/null +++ b/types/ps-tree/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for ps-tree 1.1 +// Project: http://github.com/indexzero/ps-tree +// Definitions by: Alessio Paccoia +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare namespace ps_tree { + interface PS { + COMMAND: string; + PPID: string; + PID: string; + STAT: string; + } + + const prototype: { + }; +} + +declare function ps_tree(pid: number, callback: (error: Error, children: ReadonlyArray) => void): void; + +export as namespace ps_tree; +export = ps_tree; diff --git a/types/ps-tree/ps-tree-tests.ts b/types/ps-tree/ps-tree-tests.ts new file mode 100644 index 0000000000..2ef6c48c27 --- /dev/null +++ b/types/ps-tree/ps-tree-tests.ts @@ -0,0 +1,9 @@ +import ps_tree from "ps-tree"; + +ps_tree(1, () => {}); // $ExpectType void +ps_tree(1, (error: Error, children: ReadonlyArray) => { + children[0].COMMAND; // $ExpectType string + children[0].PID; // $ExpectType string + children[0].PPID; // $ExpectType string + children[0].STAT; // $ExpectType string +}); diff --git a/types/ps-tree/tsconfig.json b/types/ps-tree/tsconfig.json new file mode 100644 index 0000000000..9bb8c2d8e1 --- /dev/null +++ b/types/ps-tree/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ps-tree-tests.ts" + ] +} diff --git a/types/ps-tree/tslint.json b/types/ps-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ps-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }