diff --git a/q/Q.d.ts b/q/Q.d.ts index a8b4b3e33..95d100721 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -8,10 +8,10 @@ declare function Q(promise: Q.IPromise): Q.Promise; declare module Q { interface IPromise { - then(onFulfill: (value: T) => U, onReject?: (reason) => U): IPromise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason) => IPromise): IPromise; then(onFulfill: (value: T) => IPromise, onReject?: (reason) => U): IPromise; then(onFulfill: (value: T) => U, onReject?: (reason) => IPromise): IPromise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason) => IPromise): IPromise; + then(onFulfill: (value: T) => U, onReject?: (reason) => U): IPromise; } interface Deferred { @@ -26,10 +26,10 @@ declare module Q { fin(finallyCallback: () => any): Promise; finally(finallyCallback: () => any): Promise; - then(onFulfill: (value: T) => U, onReject?: (reason) => U, onProgress?: Function): Promise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason) => IPromise, onProgress?: Function): Promise; then(onFulfill: (value: T) => IPromise, onReject?: (reason) => U, onProgress?: Function): Promise; then(onFulfill: (value: T) => U, onReject?: (reason) => IPromise, onProgress?: Function): Promise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason) => IPromise, onProgress?: Function): Promise; + then(onFulfill: (value: T) => U, onReject?: (reason) => U, onProgress?: Function): Promise; spread(onFulfilled: Function, onRejected?: Function): Promise; @@ -71,22 +71,22 @@ declare module Q { } // if no fulfill, reject, or progress provided, returned promise will be of same type - export function when(value: T): Promise; export function when(value: IPromise): Promise; + export function when(value: T): Promise; // If a non-promise value is provided, it will not reject or progress - export function when(value: T, onFulfilled: (val: T) => U): Promise; export function when(value: T, onFulfilled: (val: T) => IPromise): Promise; + export function when(value: T, onFulfilled: (val: T) => U): Promise; - export function when(value: IPromise, onFulfilled: (val: T) => U, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => IPromise, onRejected?: (reason) => IPromise, onProgress?: (progress) => any): Promise; export function when(value: IPromise, onFulfilled: (val: T) => IPromise, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise; export function when(value: IPromise, onFulfilled: (val: T) => U, onRejected?: (reason) => IPromise, onProgress?: (progress) => any): Promise; - export function when(value: IPromise, onFulfilled: (val: T) => IPromise, onRejected?: (reason) => IPromise, onProgress?: (progress) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => U, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise; //export function try(method: Function, ...args: any[]): Promise; // <- This is broken currently - not sure how to fix. - export function fbind(method: (...args: any[]) => T, ...args: any[]): (...args: any[]) => Promise; export function fbind(method: (...args: any[]) => IPromise, ...args: any[]): (...args: any[]) => Promise; + export function fbind(method: (...args: any[]) => T, ...args: any[]): (...args: any[]) => Promise; export function fcall(method: (...args) => T, ...args: any[]): Promise; @@ -110,14 +110,15 @@ declare module Q { export function allResolved(promises: any[]): Promise[]>; export function allResolved(promises: IPromise[]): Promise[]>; - export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason) => IPromise): Promise; export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason) => U): Promise; export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => IPromise): Promise; - export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason) => IPromise): Promise; - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => U): Promise; + + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason) => IPromise): Promise; export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason) => U): Promise; export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => IPromise): Promise; - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason) => IPromise): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => U): Promise; export function timeout(promise: Promise, ms: number, message?: string): Promise; @@ -132,8 +133,8 @@ declare module Q { export function reject(reason?): Promise; - export function promise(resolver: (resolve: (val: T) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise; export function promise(resolver: (resolve: (val: IPromise) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise; + export function promise(resolver: (resolve: (val: T) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise; export function promised(callback: (...any) => T): (...any) => Promise; @@ -147,8 +148,8 @@ declare module Q { export var oneerror: () => void; export var longStackSupport: boolean; - export function resolve(object: T): Promise; export function resolve(object: IPromise): Promise; + export function resolve(object: T): Promise; } declare module "q" {