Confused about rxjs operator imports

khpremier

I have updated the imports for rxjs operators in my project so that they now conform to the new recommended syntax, such as:

import { switchMap, debounceTime }          from 'rxjs/operators';

However when I try to follow the same pattern for the "do" operator, TypeScript complains when I build my code. In order to get it to work, I need to use the older syntax pattern such as:

import 'rxjs/add/operator/do';

Am I doing something wrong or is the older pattern still needed for the "do" operator?

Thank you!

martin

The do operator was renamed in RxJS 5.5 to tap (because do is a reserved keyword):

import { tap } from 'rxjs/operators';

For more info see section "Renamed Operators" in https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related