Skip to content

Commit ea14064

Browse files
committed
- Formatted code
1 parent 1a77773 commit ea14064

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/templates/core/CancelablePromise.hbs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ export class CancelablePromise<T> implements Promise<T> {
5353
return this.#promise.then(onFulfilled, onRejected);
5454
}
5555

56-
public catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {
56+
public catch<TResult = never>(
57+
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
58+
): Promise<T | TResult> {
5759
return this.#promise.catch(onRejected);
5860
}
5961

60-
public finally(onFinally?: (() => void) | undefined | null): Promise<T> {
62+
public finally(onFinally?: (() => void) | null): Promise<T> {
6163
return this.#promise.finally(onFinally);
6264
}
6365

@@ -71,7 +73,7 @@ export class CancelablePromise<T> implements Promise<T> {
7173
for (const cancelHandler of this.#cancelHandlers) {
7274
cancelHandler();
7375
}
74-
} catch(error) {
76+
} catch (error) {
7577
this.#reject?.(error);
7678
return;
7779
}

test/__snapshots__/index.spec.js.snap

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ export class CancelablePromise<T> implements Promise<T> {
111111
return this.#promise.then(onFulfilled, onRejected);
112112
}
113113

114-
public catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {
114+
public catch<TResult = never>(
115+
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
116+
): Promise<T | TResult> {
115117
return this.#promise.catch(onRejected);
116118
}
117119

118-
public finally(onFinally?: (() => void) | undefined | null): Promise<T> {
120+
public finally(onFinally?: (() => void) | null): Promise<T> {
119121
return this.#promise.finally(onFinally);
120122
}
121123

@@ -129,7 +131,7 @@ export class CancelablePromise<T> implements Promise<T> {
129131
for (const cancelHandler of this.#cancelHandlers) {
130132
cancelHandler();
131133
}
132-
} catch(error) {
134+
} catch (error) {
133135
this.#reject?.(error);
134136
return;
135137
}
@@ -2582,11 +2584,13 @@ export class CancelablePromise<T> implements Promise<T> {
25822584
return this.#promise.then(onFulfilled, onRejected);
25832585
}
25842586

2585-
public catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {
2587+
public catch<TResult = never>(
2588+
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
2589+
): Promise<T | TResult> {
25862590
return this.#promise.catch(onRejected);
25872591
}
25882592

2589-
public finally(onFinally?: (() => void) | undefined | null): Promise<T> {
2593+
public finally(onFinally?: (() => void) | null): Promise<T> {
25902594
return this.#promise.finally(onFinally);
25912595
}
25922596

@@ -2600,7 +2604,7 @@ export class CancelablePromise<T> implements Promise<T> {
26002604
for (const cancelHandler of this.#cancelHandlers) {
26012605
cancelHandler();
26022606
}
2603-
} catch(error) {
2607+
} catch (error) {
26042608
this.#reject?.(error);
26052609
return;
26062610
}

0 commit comments

Comments
 (0)