cdSo I\'m trying to migrate some of my Angular 5 code to 6, and I understand most of the changes required for rxjs to work using the .pipe() operator. It works as you would expe
You should be able to explicitly specify the type parameters to catchError
to indicate that it won't return an observable that emits a value - that is, it will return Observable<never>
- and will always throw:
getAlbums(): Observable<Album[]> {
return this.httpClient.get<Album[]>(this.config.urls.url("albums"))
.pipe(
map(albumList => this.albumList = albumList),
catchError<Album[], never>(new ErrorInfo().parseObservableResponseError)
);
}
Doing so will see the type inferred from the pipe
call to be Observable<Album[]>
.