-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
32 lines (28 loc) · 1.16 KB
/
index.d.ts
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
27
28
29
30
31
32
declare module "junk-bucket" {
/**
* An adapter from the standard (error, result) NodeJS callback style.
*
* At this point you should probably prefer to use the builtin node promises for the callbacks. Still useful for
* wrapping external libraries who do not yet have callbacks.
*
* @callback wrap Accepts a callback to interpret the success/callback of the NodeJS style
* @returns a promise to be resolved when the callback passed to perform function resolves.
*/
export function es6_node<T>(wrap: (err: any, value: T) => void): Promise<T>;
/**
* nope - does nothing. literally.
*/
export function nope(): void;
interface Logger {
log(...args: any[]): void;
error(...args: any[]): void;
}
/**
* Wraps the given operation and logs failures of the promise. This is primarily intended to provide async entry points
* to avoid having to re-write the this for every command
*
* @param perform An async function to be resolved or logged
* @param logger Logger to be passed to the performer and target when the application fails
*/
function main(perform: (logger: Logger) => Promise<any>, logger ?: Logger);
}