diff --git a/tns-core-modules/es6-promise.d.ts b/tns-core-modules/es6-promise.d.ts
index 5ebee38fb..97ebd77dc 100644
--- a/tns-core-modules/es6-promise.d.ts
+++ b/tns-core-modules/es6-promise.d.ts
@@ -3,16 +3,16 @@
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-interface Thenable {
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => Thenable): Thenable;
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable;
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => void): Thenable;
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => Thenable): Thenable;
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable;
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): Thenable;
+interface PromiseLike {
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => PromiseLike): PromiseLike;
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => U): PromiseLike;
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => void): PromiseLike;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike): PromiseLike;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): PromiseLike;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): PromiseLike;
}
-interface Promise extends Thenable {
+interface Promise extends PromiseLike {
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -22,7 +22,7 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => Thenable): Promise;
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => PromiseLike): Promise;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -32,7 +32,7 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => U): Promise;
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => U): Promise;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -42,7 +42,7 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => Thenable, onRejected?: (error: any) => void): Promise;
+ then(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => void): Promise;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -52,7 +52,7 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => Thenable): Promise;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike): Promise;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -62,7 +62,7 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Promise;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): Promise;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
@@ -72,13 +72,13 @@ interface Promise extends Thenable {
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
- then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): Promise;
+ then(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): Promise;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
- catch(onRejected?: (error: any) => Thenable): Promise;
+ catch(onRejected?: (error: any) => PromiseLike): Promise;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
@@ -103,27 +103,27 @@ interface PromiseConstructor {
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
- new (executor: (resolve: (value?: T | Thenable) => void, reject: (reason?: any) => void) => void): Promise;
+ new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise;
/**
* Returns promise (only if promise.constructor == Promise)
*/
- cast(promise: Promise): Promise;
+ cast(promise: Promise): Promise;
/**
* Make a promise that fulfills to obj.
*/
- cast(object: R): Promise;
+ cast(object: T): Promise;
/**
- * Make a new promise from the thenable.
- * A thenable is promise-like in as far as it has a "then" method.
+ * Make a new promise from the PromiseLike.
+ * A promise-like can be anything as far as it has a "then" method.
* This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast.
*/
- resolve(thenable?: Thenable): Promise;
+ resolve(promise?: PromiseLike): Promise;
/**
* Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation.
*/
- resolve(object?: R): Promise;
+ resolve(object?: T): Promise;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
@@ -135,12 +135,12 @@ interface PromiseConstructor {
* 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.
*/
- all(promises: Promise[]): Promise;
+ all(promises: Promise[]): Promise;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
- race(promises: Promise[]): Promise;
+ race(promises: Promise[]): Promise;
}
declare var Promise: PromiseConstructor;
diff --git a/tns-core-modules/ui/animation/animation.d.ts b/tns-core-modules/ui/animation/animation.d.ts
index a4dda94bd..00b906f38 100644
--- a/tns-core-modules/ui/animation/animation.d.ts
+++ b/tns-core-modules/ui/animation/animation.d.ts
@@ -87,9 +87,9 @@
*/
export class AnimationPromise extends Promise {
cancel(): void;
- then(onFulfilled?: (value?: any) => Thenable, onRejected?: (error?: any) => Thenable): AnimationPromise;
+ then(onFulfilled?: (value?: any) => PromiseLike, onRejected?: (error?: any) => PromiseLike): AnimationPromise;
then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise;
- catch(onRejected?: (error?: any) => Thenable): AnimationPromise;
+ catch(onRejected?: (error?: any) => PromiseLike): AnimationPromise;
catch(onRejected?: (error?: any) => void): AnimationPromise;
}