diff --git a/q/Q.d.ts b/q/Q.d.ts index 95d1007212..a9126c0077 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) => 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) => U, onReject?: (reason) => U): IPromise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => IPromise): IPromise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => U): IPromise; + then(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise): IPromise; + then(onFulfill: (value: T) => U, onReject?: (reason: any) => U): IPromise; } interface Deferred { @@ -19,28 +19,28 @@ declare module Q { resolve(value: T): void; reject(reason: any): void; notify(value: any): void; - makeNodeResolver(): (reason, value: T) => void; + makeNodeResolver(): (reason: any, value: T) => void; } interface Promise { fin(finallyCallback: () => any): Promise; finally(finallyCallback: () => any): 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) => U, onReject?: (reason) => U, onProgress?: Function): Promise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => IPromise, onProgress?: Function): Promise; + then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => U, onProgress?: Function): Promise; + then(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise, onProgress?: Function): Promise; + then(onFulfill: (value: T) => U, onReject?: (reason: any) => U, onProgress?: Function): Promise; spread(onFulfilled: Function, onRejected?: Function): Promise; - fail(onRejected: (reason) => U): Promise; - fail(onRejected: (reason) => IPromise): Promise; - catch(onRejected: (reason) => U): Promise; - catch(onRejected: (reason) => IPromise): Promise; + fail(onRejected: (reason: any) => U): Promise; + fail(onRejected: (reason: any) => IPromise): Promise; + catch(onRejected: (reason: any) => U): Promise; + catch(onRejected: (reason: any) => IPromise): Promise; - progress(onProgress: (progress) => any): Promise; + progress(onProgress: (progress: any) => any): Promise; - done(onFulfilled?: (value: T) => any, onRejected?: (reason) => any, onProgress?: (progress) => any): void; + done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void; get(propertyName: String): Promise; set(propertyName: String, value: any): Promise; @@ -78,17 +78,17 @@ declare module Q { 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) => 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) => U, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => IPromise, onRejected?: (reason: any) => IPromise, onProgress?: (progress: any) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => IPromise, onRejected?: (reason: any) => U, onProgress?: (progress: any) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => U, onRejected?: (reason: any) => IPromise, onProgress?: (progress: any) => any): Promise; + export function when(value: IPromise, onFulfilled: (val: T) => U, onRejected?: (reason: any) => U, onProgress?: (progress: any) => 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[]) => 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; + export function fcall(method: (...args: any[]) => T, ...args: any[]): Promise; export function send(obj: any, functionName: string, ...args: any[]): Promise; export function invoke(obj: any, functionName: string, ...args: any[]): Promise; @@ -110,15 +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[]) => 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[]) => U, onRejected: (reason) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason: any) => 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[]) => U, onRejected: (reason) => U): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason: any) => U): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason: any) => U): Promise; export function timeout(promise: Promise, ms: number, message?: string): Promise; @@ -131,18 +131,18 @@ declare module Q { export function defer(): Deferred; - export function reject(reason?): Promise; + export function reject(reason?: any): 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 promise(resolver: (resolve: (val: IPromise) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; + export function promise(resolver: (resolve: (val: T) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; - export function promised(callback: (...any) => T): (...any) => Promise; + export function promised(callback: (...args: any[]) => T): (...args: any[]) => Promise; - export function isPromise(object): boolean; - export function isPromiseAlike(object): boolean; - export function isPending(object): boolean; + export function isPromise(object: any): boolean; + export function isPromiseAlike(object: any): boolean; + export function isPending(object: any): boolean; - export function async(generatorFunction: any): (...args) => Promise; + export function async(generatorFunction: any): (...args: any[]) => Promise; export function nextTick(callback: Function): void; export var oneerror: () => void;