diff --git a/src/templates/core/CancelablePromise.hbs b/src/templates/core/CancelablePromise.hbs index 2d65e219..29adb47e 100644 --- a/src/templates/core/CancelablePromise.hbs +++ b/src/templates/core/CancelablePromise.hbs @@ -53,11 +53,13 @@ export class CancelablePromise implements Promise { return this.#promise.then(onFulfilled, onRejected); } - public catch(onRejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise { + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { return this.#promise.catch(onRejected); } - public finally(onFinally?: (() => void) | undefined | null): Promise { + public finally(onFinally?: (() => void) | null): Promise { return this.#promise.finally(onFinally); } @@ -71,7 +73,7 @@ export class CancelablePromise implements Promise { for (const cancelHandler of this.#cancelHandlers) { cancelHandler(); } - } catch(error) { + } catch (error) { this.#reject?.(error); return; } diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index 34795e5e..5ea1b3a2 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -111,11 +111,13 @@ export class CancelablePromise implements Promise { return this.#promise.then(onFulfilled, onRejected); } - public catch(onRejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise { + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { return this.#promise.catch(onRejected); } - public finally(onFinally?: (() => void) | undefined | null): Promise { + public finally(onFinally?: (() => void) | null): Promise { return this.#promise.finally(onFinally); } @@ -129,7 +131,7 @@ export class CancelablePromise implements Promise { for (const cancelHandler of this.#cancelHandlers) { cancelHandler(); } - } catch(error) { + } catch (error) { this.#reject?.(error); return; } @@ -2582,11 +2584,13 @@ export class CancelablePromise implements Promise { return this.#promise.then(onFulfilled, onRejected); } - public catch(onRejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise { + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { return this.#promise.catch(onRejected); } - public finally(onFinally?: (() => void) | undefined | null): Promise { + public finally(onFinally?: (() => void) | null): Promise { return this.#promise.finally(onFinally); } @@ -2600,7 +2604,7 @@ export class CancelablePromise implements Promise { for (const cancelHandler of this.#cancelHandlers) { cancelHandler(); } - } catch(error) { + } catch (error) { this.#reject?.(error); return; }