Skip to content

Commit 61e1963

Browse files
feat(component-store): accept error type in tapResponse (#3056)
1 parent a337da3 commit 61e1963

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/component-store/src/tap-response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import { catchError, tap } from 'rxjs/operators';
1717
* (alert) => this.alertsService.dismissAlert(alert).pipe(
1818
* tapResponse(
1919
* (dismissedAlert) => this.alertDismissed(dismissedAlert),
20-
* (error) => this.logError(error),
20+
* (error: { message: string }) => this.logError(error.message),
2121
* ))));
2222
* });
2323
* ```
2424
*/
2525
export function tapResponse<T>(
2626
nextFn: (next: T) => void,
27-
errorFn: (error: unknown) => void,
27+
errorFn: <E = unknown>(error: E) => void,
2828
completeFn?: () => void
2929
): (source: Observable<T>) => Observable<T> {
3030
return (source) =>

projects/ngrx.io/content/guide/component-store/effect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ An easy way to handle the response in ComponentStore effects in a safe way, with
8585
//👇 Act on the result within inner pipe.
8686
tapResponse(
8787
(movie) => this.addMovie(movie),
88-
(error) => this.logError(e),
88+
(error: HttpErrorResponse) => this.logError(error),
8989
),
9090
)),
9191
);
9292
});
93-
</code-example>
93+
</code-example>

0 commit comments

Comments
 (0)