diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index a8f8d7845..c0a77edd8 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -3,13 +3,13 @@ // Definitions by: François de Campredon , vvakame // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; +interface Thenable { + then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Thenable; catch(onRejected?: (error: any) => U | Thenable): Thenable; } -declare class Promise implements Thenable { +declare class Promise implements Thenable { /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. @@ -17,7 +17,7 @@ declare class Promise implements Thenable { * For consistency and debugging (eg stack traces), obj should be an instanceof Error. * Any errors thrown in the constructor callback will be implicitly passed to reject(). */ - constructor(callback: (resolve : (value?: R | Thenable) => void, reject: (error?: any) => void) => void); + constructor(callback: (resolve : (value?: T | Thenable) => void, reject: (error?: any) => void) => void); /** * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. @@ -29,8 +29,8 @@ declare class Promise implements Thenable { * @param onFulfilled called when/if "promise" resolves * @param onRejected called when/if "promise" rejects */ - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Promise; + then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Promise; /** * Sugar for promise.then(undefined, onRejected) @@ -45,7 +45,7 @@ declare module Promise { * Make a new promise from the thenable. * A thenable is promise-like in as far as it has a "then" method. */ - function resolve(value?: R | Thenable): Promise; + function resolve(value?: T | Thenable): Promise; /** * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error @@ -57,12 +57,12 @@ declare module Promise { * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - function all(promises: (R | Thenable)[]): Promise; + function all(promises: (T | Thenable)[]): Promise; /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. */ - function race(promises: (R | Thenable)[]): Promise; + function race(promises: (T | Thenable)[]): Promise; } declare module 'es6-promise' {