From b6fb469b7fb6ca4cc48b396cf64db885228b4693 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 16 Jun 2024 09:49:19 +0200 Subject: [PATCH] Add 'deferred' modifiers to Promise methods --- src/lib/es2018.promise.d.ts | 2 +- src/lib/es5.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/es2018.promise.d.ts b/src/lib/es2018.promise.d.ts index 070c4972f11..49171882e66 100644 --- a/src/lib/es2018.promise.d.ts +++ b/src/lib/es2018.promise.d.ts @@ -8,5 +8,5 @@ interface Promise { * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). * @returns A Promise for the completion of the callback. */ - finally(onfinally?: (() => void) | undefined | null): Promise; + finally(deferred onfinally?: (() => void) | undefined | null): Promise; } diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 33bbb991474..0ed54745a74 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1516,7 +1516,7 @@ 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) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; + then(deferred onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, deferred onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; } /** @@ -1529,14 +1529,14 @@ 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) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + then(deferred onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, deferred onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + catch(deferred onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; } /**