Skip to content

Commit

Permalink
Improved type definitions and provided test/types.ts to validate the …
Browse files Browse the repository at this point in the history
…usage
  • Loading branch information
borekb committed Sep 19, 2017
1 parent e4839ce commit 13752ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/**
* Kills `pid` and all its children
* Kills process identified by `pid` and all its children
*
* @param pid
* @param signal 'SIGTERM' by default
* @param callback Called when killing of the entire tree is done, and it's the result
* of the platform-specific killing command (see docs).
* @param callback
*/
declare function treeKill(
pid: number,
signal: string,
callback?: (error: Error, stdout: string, stderr: string) => void,
signal?: string | number,
callback?: (error?: Error) => void,
): void;

declare namespace treeKill {}

export = treeKill;
17 changes: 17 additions & 0 deletions test/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// examples of valid usage
// importing just the type definitions, not the actual code
import * as kill from '../index.d';


kill(1);
kill(1, 9);
kill(1, 'SIGKILL');
kill(1, 'SIGKILL', () => {
console.log('done');
});
kill(1, 'SIGKILL', (err) => {
if (err) {
console.log(err.message);
}
console.log('done');
});

0 comments on commit 13752ab

Please sign in to comment.