Merge pull request #31288 from BendingBender/ps-list

Add types for ps-list
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 14:55:23 -08:00
committed by GitHub
4 changed files with 61 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for ps-list 6.0
// Project: https://github.com/sindresorhus/ps-list#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export = psList;
declare function psList(options?: psList.Options): Promise<psList.ProcessDescriptor[]>;
declare namespace psList {
interface Options {
all?: boolean;
}
interface ProcessDescriptor {
pid: number;
name: string;
ppid: number;
cmd?: string;
cpu?: number;
memory?: number;
}
}
+13
View File
@@ -0,0 +1,13 @@
import psList = require('ps-list');
(async () => {
const processes: psList.ProcessDescriptor[] = await psList();
psList({ all: false });
processes[0].pid; // $ExpectType number
processes[0].name; // $ExpectType string
processes[0].ppid; // $ExpectType number
processes[0].cmd; // $ExpectType string | undefined
processes[0].cpu; // $ExpectType number | undefined
processes[0].memory; // $ExpectType number | undefined
})();
+23
View File
@@ -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",
"ps-list-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }