Add when(x) overloads

This commit is contained in:
Wim Looman
2014-12-06 12:29:44 +13:00
parent 0adc6614cb
commit d72601e320
+8
View File
@@ -3,6 +3,10 @@
// Definitions by: Derek Cicerone <https://github.com/derekcicerone>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare function When<T>(value: When.Promise<T>): When.Promise<T>;
declare function When<T>(value: When.Thenable<T>): When.Promise<T>;
declare function When<T>(value: T): When.Promise<T>;
declare module When {
/**
@@ -80,6 +84,10 @@ declare module When {
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
}
interface Thenable<T> {
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Thenable<U>;
}
interface Snapshot<T> {
state: string;
value?: T;