Skip to content

Commit

Permalink
Add: typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
legraphista committed Jun 13, 2019
1 parent 56b74bc commit 0c41ff8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type SIGNAL = "SIGSEGV" | string;

export type CrashCallback = (signal: SIGNAL, address: string, stack: string[]) => any;

This comment has been minimized.

Copy link
@OmgImAlexis

OmgImAlexis Jul 3, 2022

This should return void, no?

This comment has been minimized.

Copy link
@legraphista

legraphista Jul 5, 2022

Author Contributor

Most likely yes, I think the result of that function is discarded either way

This comment has been minimized.

Copy link
@OmgImAlexis

OmgImAlexis Jul 5, 2022

In that case it should be typed as void since it's not expecting a return value. Having this typed as any made me think it was expecting the callback to return the formatted string it was writing to the crash log. Only this isn't the case.

This comment has been minimized.

Copy link
@OmgImAlexis

OmgImAlexis Jul 5, 2022

Fixed in #82


export function registerHandler(): void;
export function registerHandler(file: string): void;
export function registerHandler(file: string, callback: CrashCallback): void;

export function causeSegfault(): void;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"nan": "^2.13.2"
},
"main": "index.js",
"types": "index.d.ts",
"license": "BSD-3-Clause"
}

0 comments on commit 0c41ff8

Please sign in to comment.