UNPKG

797 BTypeScriptView Raw
1declare const loudRejection: {
2 /**
3 Make unhandled promise rejections fail loudly instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2).
4
5 @param log - Custom logging function to print the rejected promise. Receives the error stack. Default: `console.error`.
6
7 @example
8 ```
9 import loudRejection = require('loud-rejection');
10 import promiseFunction = require('promise-fn');
11
12 // Install the `unhandledRejection` listeners
13 loudRejection();
14
15 promiseFunction();
16 ```
17 */
18 (log?: (stack: string) => void): void;
19
20 // TODO: remove this in the next major version, refactor the whole definition to:
21 // declare function loudRejection(log?: (stack: string) => void): void;
22 // export = loudRejection;
23 default: typeof loudRejection;
24};
25
26export = loudRejection;