55 * Use of this source code is governed by an MIT-style license that can be
66 * found in the LICENSE file at https://angular.io/license
77 */
8- import { patchMethod } from './utils' ;
98import { ZoneType } from '../zone-impl' ;
109
10+ import { patchMethod } from './utils' ;
11+
1112export function patchPromise ( Zone : ZoneType ) : void {
1213 Zone . __load_patch ( 'ZoneAwarePromise' , ( global : any , Zone : ZoneType , api : _ZonePrivate ) => {
1314 const ObjectGetOwnPropertyDescriptor = Object . getOwnPropertyDescriptor ;
@@ -61,7 +62,8 @@ export function patchPromise(Zone: ZoneType): void {
6162 }
6263 } ;
6364
64- const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__ ( 'unhandledPromiseRejectionHandler' ) ;
65+ const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL =
66+ __symbol__ ( 'unhandledPromiseRejectionHandler' ) ;
6567
6668 function handleUnhandledRejection ( this : unknown , e : any ) {
6769 api . onUnhandledError ( e ) ;
@@ -257,7 +259,7 @@ export function patchPromise(Zone: ZoneType): void {
257259 const delegate = promiseState ?
258260 ( typeof onFulfilled === 'function' ) ? onFulfilled : forwardResolution :
259261 ( typeof onRejected === 'function' ) ? onRejected :
260- forwardRejection ;
262+ forwardRejection ;
261263 zone . scheduleMicroTask ( source , ( ) => {
262264 try {
263265 const parentPromiseValue = ( promise as any ) [ symbolValue ] ;
@@ -454,8 +456,8 @@ export function patchPromise(Zone: ZoneType): void {
454456 }
455457
456458 constructor (
457- executor :
458- ( resolve : ( value ?: R | PromiseLike < R > ) => void , reject : ( error ?: any ) => void ) => void ) {
459+ executor : ( resolve : ( value ?: R | PromiseLike < R > ) => void , reject : ( error ?: any ) => void ) =>
460+ void ) {
459461 const promise : ZoneAwarePromise < R > = this ;
460462 if ( ! ( promise instanceof ZoneAwarePromise ) ) {
461463 throw new Error ( 'Must be an instanceof Promise.' ) ;
@@ -490,9 +492,9 @@ export function patchPromise(Zone: ZoneType): void {
490492 // `this.constructor` will be undefined. One of the use cases is SystemJS creating
491493 // prototype-less objects (modules) via `Object.create(null)`. The SystemJS creates an empty
492494 // object and copies promise properties into that object (within the `getOrCreateLoad`
493- // function). The zone.js then checks if the resolved value has the `then` method and invokes
494- // it with the `value` context. Otherwise, this will throw an error: `TypeError: Cannot read
495- // properties of undefined (reading 'Symbol(Symbol.species)')`.
495+ // function). The zone.js then checks if the resolved value has the `then` method and
496+ // invokes it with the `value` context. Otherwise, this will throw an error: `TypeError:
497+ // Cannot read properties of undefined (reading 'Symbol(Symbol.species)')`.
496498 let C = ( this . constructor as any ) ?. [ Symbol . species ] ;
497499 if ( ! C || typeof C !== 'function' ) {
498500 C = this . constructor || ZoneAwarePromise ;
@@ -507,8 +509,8 @@ export function patchPromise(Zone: ZoneType): void {
507509 return chainPromise ;
508510 }
509511
510- catch < TResult = never > ( onRejected ?: ( ( reason : any ) => TResult | PromiseLike < TResult > ) | undefined |
511- null ) : Promise < R | TResult > {
512+ catch < TResult = never > ( onRejected ?: ( ( reason : any ) => TResult | PromiseLike < TResult > ) |
513+ undefined | null ) : Promise < R | TResult > {
512514 return this . then ( null , onRejected ) ;
513515 }
514516
0 commit comments