From ea1406443b20ef9907cf827a5be36f8a099e7118 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Tue, 19 Oct 2021 22:06:34 +0200 Subject: [PATCH] - Formatted code --- src/templates/core/CancelablePromise.hbs | 8 +++++--- test/__snapshots__/index.spec.js.snap | 16 ++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) 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; }