Merge pull request #25896 from alessiopcc/ps-tree

Add ps-tree definitions
This commit is contained in:
Daniel Rosenwasser
2018-05-23 22:46:48 -07:00
committed by GitHub
4 changed files with 56 additions and 0 deletions

22
types/ps-tree/index.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
// Type definitions for ps-tree 1.1
// Project: http://github.com/indexzero/ps-tree
// Definitions by: Alessio Paccoia <https://github.com/alessiopcc>
// 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<ps_tree.PS>) => void): void;
export as namespace ps_tree;
export = ps_tree;

View File

@@ -0,0 +1,9 @@
import ps_tree from "ps-tree";
ps_tree(1, () => {}); // $ExpectType void
ps_tree(1, (error: Error, children: ReadonlyArray<ps_tree.PS>) => {
children[0].COMMAND; // $ExpectType string
children[0].PID; // $ExpectType string
children[0].PPID; // $ExpectType string
children[0].STAT; // $ExpectType string
});

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }