Property 'do' does not exist on type 'Observable'

后端 未结 5 1342
遇见更好的自我
遇见更好的自我 2021-02-01 02:04

After upgrading to Angular 6.0 and Rxjs to 6.0 I receive the following compilation error:

Property \'do\' does not exist on type \'Observable\'.

Her

5条回答
  •  孤独总比滥情好
    2021-02-01 02:39

    Rxjs 6 has introduced some breaking changes and the "do" operator has been replaced by the "tap" operator (from 'rxjs/internal/operators').

    You could refactor your code using the new operator or still use the old 'do' syntax by adding the rxjs-compat library for backward compatibility (npm install --save rxjs-compat).

    Note that before RxJs 6 you had to import the 'do' operator :

    import 'rxjs/add/operator/do';
    

    More details here : Angular HTTP GET with TypeScript error http.get(...).map is not a function in [null]

提交回复
热议问题