From 61e1963e36290b932044049200027552fb164f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Stanimirovi=C4=87?= Date: Tue, 29 Jun 2021 18:09:44 +0200 Subject: [PATCH] feat(component-store): accept error type in `tapResponse` (#3056) --- modules/component-store/src/tap-response.ts | 4 ++-- projects/ngrx.io/content/guide/component-store/effect.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/component-store/src/tap-response.ts b/modules/component-store/src/tap-response.ts index 17c0c68433..5f5a364a91 100644 --- a/modules/component-store/src/tap-response.ts +++ b/modules/component-store/src/tap-response.ts @@ -17,14 +17,14 @@ import { catchError, tap } from 'rxjs/operators'; * (alert) => this.alertsService.dismissAlert(alert).pipe( * tapResponse( * (dismissedAlert) => this.alertDismissed(dismissedAlert), - * (error) => this.logError(error), + * (error: { message: string }) => this.logError(error.message), * )))); * }); * ``` */ export function tapResponse( nextFn: (next: T) => void, - errorFn: (error: unknown) => void, + errorFn: (error: E) => void, completeFn?: () => void ): (source: Observable) => Observable { return (source) => diff --git a/projects/ngrx.io/content/guide/component-store/effect.md b/projects/ngrx.io/content/guide/component-store/effect.md index 59a23119dc..a0a3838b9b 100644 --- a/projects/ngrx.io/content/guide/component-store/effect.md +++ b/projects/ngrx.io/content/guide/component-store/effect.md @@ -85,9 +85,9 @@ An easy way to handle the response in ComponentStore effects in a safe way, with //👇 Act on the result within inner pipe. tapResponse( (movie) => this.addMovie(movie), - (error) => this.logError(e), + (error: HttpErrorResponse) => this.logError(error), ), )), ); }); - \ No newline at end of file +