Skip to content

Commit

Permalink
Merge pull request #3 from electrovir/add-types
Browse files Browse the repository at this point in the history
Add Typescript definitions
  • Loading branch information
ehmicky authored Mar 6, 2020
2 parents 07cbba5 + a9db944 commit 152d187
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1.0

- Typescript definitions added

# 2.0.0

## Breaking changes
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"lib": "src",
"test": "test"
},
"types": "build/src/main.d.ts",
"dependencies": {},
"devDependencies": {
"@ehmicky/dev-tasks": "^0.31.9",
Expand Down
52 changes: 52 additions & 0 deletions src/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Object whose keys are signal names and values are signal objects.
*/
export declare const signalsByName: { [signalName: string]: Signal }
/**
* Object whose keys are signal numbers and values are signal objects.
*/
export declare const signalsByNumber: { [signalNumber: string]: Signal }

export declare type SignalAction =
| 'terminate'
| 'core'
| 'ignore'
| 'pause'
| 'unpause'
export declare type SignalStandard =
| 'ansi'
| 'posix'
| 'bsd'
| 'systemv'
| 'other'

export declare type Signal = {
/**
* Standard name of the signal, for example 'SIGINT'.
*/
name: string
/**
* Code number of the signal, for example 2. While most number are cross-platform, some are different between different OS.
*/
number: number
/**
* Human-friendly description for the signal, for example 'User interruption with CTRL-C'.
*/
description: string
/**
* Whether the current OS can handle this signal in Node.js using process.on(name, handler). The list of supported signals is OS-specific.
*/
supported: boolean
/**
* What is the default action for this signal when it is not handled.
*/
action: SignalAction
/**
* Whether the signal's default action cannot be prevented. This is true for SIGTERM, SIGKILL and SIGSTOP.
*/
forced: boolean
/**
* Which standard defined that signal.
*/
standard: SignalStandard
}

0 comments on commit 152d187

Please sign in to comment.