// Type definitions for tspromise 0.0.4 // Project: https://github.com/soywiz/tspromise // Definitions by: Carlos Ballesteros Velasco // Definitions: https://github.com/borisyankov/DefinitelyTyped /// declare class Thenable { then(onFulfilled: (value: T) => Thenable, onRejected?: (error: Error) => TR): Thenable; then(onFulfilled: (value: T) => Thenable, onRejected?: (error: Error) => void): Thenable; then(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable; then(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable; catch(onRejected: (error: Error) => T): Thenable; } interface NodeCallback { (err: Error, value: T): void; } declare module "tspromise" { class Promise extends Thenable { constructor(callback: (resolve: (value?: T) => void, reject?: (error: Error) => void) => void); static resolve(value?: T): Thenable; static resolve(promise: Thenable): Thenable; static reject(error: Error): Thenable; static all(promises: Thenable[]): Thenable; static async(callback: () => TR): () => Thenable; static async(callback: (p1: T1) => TR): (p1: T1) => Thenable; static async(callback: (p1: T1, p2: T2) => TR): (p1: T1, p2: T2) => Thenable; static async(callback: (p1: T1, p2: T2, p3: T3) => TR): (p1: T1, p2: T2, p3: T3) => Thenable; static async(callback: (p1: T1, p2: T2, p3: T3, p4: T4) => TR): (p1: T1, p2: T2, p3: T3, p4: T4) => Thenable; static spawn(generatorFunction: () => TR): Thenable; static rewriteFolderSync(path: string): void; static waitAsync(time: number): Thenable<{}>; static nfcall(obj: any, methodName: String, ...args: any[]): Thenable; } export = Promise; } declare function yield(promise: Thenable): T;