File: index.d.ts

package info (click to toggle)
node-loud-rejection 2.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 148 kB
  • sloc: javascript: 224; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
declare const loudRejection: {
	/**
	Make unhandled promise rejections fail loudly instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2).

	@param log - Custom logging function to print the rejected promise. Receives the error stack. Default: `console.error`.

	@example
	```
	import loudRejection = require('loud-rejection');
	import promiseFunction = require('promise-fn');

	// Install the `unhandledRejection` listeners
	loudRejection();

	promiseFunction();
	```
	*/
	(log?: (stack: string) => void): void;

	// TODO: remove this in the next major version, refactor the whole definition to:
	// declare function loudRejection(log?: (stack: string) => void): void;
	// export = loudRejection;
	default: typeof loudRejection;
};

export = loudRejection;