Skip to content

Commit

Permalink
feat(component-store): accept error type in tapResponse (#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
markostanimirovic authored Jun 29, 2021
1 parent a337da3 commit 61e1963
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/component-store/src/tap-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(
nextFn: (next: T) => void,
errorFn: (error: unknown) => void,
errorFn: <E = unknown>(error: E) => void,
completeFn?: () => void
): (source: Observable<T>) => Observable<T> {
return (source) =>
Expand Down
4 changes: 2 additions & 2 deletions projects/ngrx.io/content/guide/component-store/effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
)),
);
});
</code-example>
</code-example>

0 comments on commit 61e1963

Please sign in to comment.