mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 21:40:21 +00:00
Merge pull request #31288 from BendingBender/ps-list
Add types for ps-list
This commit is contained in:
Vendored
+24
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
})();
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user