From 87b0afb72d857d265fc6b4c191524882f0dffefc Mon Sep 17 00:00:00 2001 From: JiaLiPassion Date: Thu, 28 Dec 2017 04:44:53 +0900 Subject: [PATCH] fix(fakeAsyncTest): fix #937, let user be able to customize testable macroTask (#938) * fix(fakeAsyncTest): fix #937, let user be able to customize testable macroTask * add global flag to define fakeAsyncTest macroTaskOptions * support set callback arguments --- lib/common/promise.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/common/promise.ts b/lib/common/promise.ts index 866486377..5e904d73c 100644 --- a/lib/common/promise.ts +++ b/lib/common/promise.ts @@ -207,9 +207,9 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr } } - function scheduleResolveOrReject( + function scheduleResolveOrReject( promise: ZoneAwarePromise, zone: AmbientZone, chainPromise: ZoneAwarePromise, - onFulfilled?: (value: R) => U1, onRejected?: (error: any) => U2): void { + onFulfilled?: (value: R) => U, onRejected?: (error: any) => V): void { clearRejectedNoCatch(promise); const delegate = (promise as any)[symbolState] ? (typeof onFulfilled === FUNCTION) ? onFulfilled : forwardResolution : @@ -310,7 +310,7 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr onFulfilled?: ((value: R) => TResult1 | PromiseLike)|undefined|null, onRejected?: ((reason: any) => TResult2 | PromiseLike)|undefined| null): Promise { - const chainPromise: Promise = + const chainPromise: Promise = new (this.constructor as typeof ZoneAwarePromise)(null); const zone = Zone.current; if ((this as any)[symbolState] == UNRESOLVED) {