mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add missing error-handling methods
* also added the inspect method (https://github.com/cujojs/when/blob/master/docs/api.md#inspect)
This commit is contained in:
Vendored
+14
@@ -55,11 +55,25 @@ declare module When {
|
||||
}
|
||||
|
||||
interface Promise<T> {
|
||||
catch<U>(onRejected?: (reason: any) => Promise<U>): Promise<U>;
|
||||
catch<U>(onRejected?: (reason: any) => U): Promise<U>;
|
||||
|
||||
ensure(onFulfilledOrRejected: Function): Promise<T>;
|
||||
|
||||
inspect(): Snapshot<T>;
|
||||
|
||||
otherwise<U>(onRejected?: (reason: any) => Promise<U>): Promise<U>;
|
||||
otherwise<U>(onRejected?: (reason: any) => U): Promise<U>;
|
||||
|
||||
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
|
||||
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
|
||||
}
|
||||
|
||||
interface Snapshot<T> {
|
||||
state: string;
|
||||
value?: T;
|
||||
reason?: any;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user