diff --git a/types/q/index.d.ts b/types/q/index.d.ts index 2a04f56847..56ada9590a 100644 --- a/types/q/index.d.ts +++ b/types/q/index.d.ts @@ -11,7 +11,7 @@ export as namespace Q; * If value is a Q promise, returns the promise. * If value is a promise from another library it is coerced into a Q promise (where possible). */ -declare function Q(promise: Q.IPromise): Q.Promise; +declare function Q(promise: PromiseLike): Q.Promise; /** * If value is not a promise, returns a promise that is fulfilled with value. */ @@ -22,10 +22,9 @@ declare function Q(value: T): Q.Promise; declare function Q(): Q.Promise; declare namespace Q { - export type IWhenable = IPromise | T; - export interface IPromise { - then(onFulfill?: (value: T) => IWhenable, onReject?: (error: any) => IWhenable): IPromise; - } + + export type IWhenable = PromiseLike | T; + export type IPromise = PromiseLike; export interface Deferred { promise: Promise; @@ -224,7 +223,10 @@ declare namespace Q { /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: IWhenable<[IWhenable, IWhenable]>): Promise<[A, B]>; + export function all(promises: IWhenable<[IPromise, IPromise]>): Promise<[A, B]>; + export function all(promises: IWhenable<[A, IPromise]>): Promise<[A, B]>; + export function all(promises: IWhenable<[IPromise, B]>): Promise<[A, B]>; + export function all(promises: IWhenable<[A, B]>): Promise<[A, B]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */