forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpromise.d.ts
42 lines (34 loc) · 1.18 KB
/
mpromise.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
33
34
35
36
37
38
39
40
41
42
// Type definitions for mpromise 0.5.4
// Project: https://github.com/aheckmann/mpromise
// Definitions by: Seulgi Kim <https://github.com/sgkim126/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "mpromise" {
interface IFulfillFunction<F> {
(...args: F[]): void;
(arg: F): void;
}
interface IRejectFunction<R> {
(err: R): void;
}
interface IResolveFunction<F, R> {
(err: R, ...args: F[]): void;
(err: R, arg: F): void;
}
class Promise<F, R> {
constructor(fn?: IResolveFunction<F, R>);
static FAILURE: string;
static SUCCESS: string;
fulfill(...args: F[]): Promise<F, R>;
fulfill(arg: F): Promise<F, R>;
reject(reason: R): Promise<F, R>;
resolve(reason: R, ...args: F[]): Promise<F, R>;
resolve(reason: R, arg: F): Promise<F, R>;
onFulfill(callback: IFulfillFunction<F>): Promise<F, R>;
onReject(callback: IRejectFunction<R>): Promise<F, R>;
onResolve(callback: IResolveFunction<F, R>): Promise<F, R>;
then<F, R>(onFulfilled: IFulfillFunction<F>, onRejected?: IRejectFunction<R>): Promise<F, R>;
end(): void;
chain(promise: Promise<F, R>): Promise<F, R>;
}
export = Promise;
}