From 490fa2f8296acab35a3cf527d992bfa0b288ed48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= Date: Wed, 20 Apr 2016 12:39:11 +0200 Subject: [PATCH 1/5] Update es5.d.ts Extend definition of the `onfulfilled` handler for the `PromiseLike` interface --- src/lib/es5.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 17916d5548e12..50670bff16213 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1264,8 +1264,8 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + then(onfulfilled?: (value: T | PromiseLike) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T | PromiseLike) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } interface ArrayLike { From 5e5203f48a474943f4675c893fe7b907b16cab78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= Date: Wed, 20 Apr 2016 12:40:50 +0200 Subject: [PATCH 2/5] Update es2015.promise.d.ts Extend definiton for interface `Promise`: take into account that `onfulfilled` is undefined --- src/lib/es2015.promise.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts index 6ade205dc4254..dfab0a1499442 100644 --- a/src/lib/es2015.promise.d.ts +++ b/src/lib/es2015.promise.d.ts @@ -8,8 +8,8 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. @@ -78,4 +78,4 @@ interface PromiseConstructor { resolve(): Promise; } -declare var Promise: PromiseConstructor; \ No newline at end of file +declare var Promise: PromiseConstructor; From df1066b46b2632b920cc1aa8c1184d2e02f7c31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= Date: Thu, 21 Apr 2016 09:03:08 +0200 Subject: [PATCH 3/5] Update es5.d.ts Revert changes in PromiseLike interface --- src/lib/es5.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 50670bff16213..7a6d3a5ddb4e5 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1264,8 +1264,8 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T | PromiseLike) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T | PromiseLike) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } interface ArrayLike { From ab38df731916d91d3bde2e2cc9ceb9890975c324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= Date: Thu, 21 Apr 2016 09:07:39 +0200 Subject: [PATCH 4/5] Update es2015.promise.d.ts Corrections to return type of `then` method in `Promise` interface. --- src/lib/es2015.promise.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts index dfab0a1499442..b825b455458ee 100644 --- a/src/lib/es2015.promise.d.ts +++ b/src/lib/es2015.promise.d.ts @@ -8,8 +8,11 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + then(onfulfilled?: null | undefined, onrejected?: null | undefined): Promise; + then(onfulfilled?: null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: null | undefined, onrejected: (reason: any) => void): Promise; + then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. From 57dd8a6d93609bacf9f54fa0cfa857f79986a921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= Date: Sat, 23 Apr 2016 17:39:31 +0200 Subject: [PATCH 5/5] Update es5.d.ts --- src/lib/es5.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7a6d3a5ddb4e5..17916d5548e12 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1264,8 +1264,8 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } interface ArrayLike {