Search code examples
angularangular-upgrade

error TS2339: Property 'do' does not exist on type 'Observable<


Trying to upgrade from angular 5.2 to angular 6.0.0, we are running into the following error:

error TS2339: Property 'do' does not exist on type 'Observable<

Any ideas why?

The Code where we are using is

return this.httpClient.post<x>(`${environment.apiUrl}auth/x/`,
  this.abcd,
  httpOptions)
  .do(x1 => this.subject.next(x1))

Solution

  • Chain operators were deprecated a while back and now they're removed. Use pipeable operators, in this case tap replaces do.

    import { tap } from 'rxjs/operators';
    
    return this.httpClient.post(ˋ${environment.apiUrl}auth/x/ˋ, this.abcd, httpOptions)
    .pipe(
        tap(x1 => this.subject.next(x1))
    );