lynxSven
lynxSven

Reputation: 594

Angular 5 -> Angular 6 Rxjs .map() to .pipe(map())

I have an Angular 5 project which has many modules and hundreds of components. Since RxJs 6 you have to use

someObservable.pipe(map(...))

instead of

someObservable.map(...)

I want to migrate this project from Angular 5 to 6, but dont want to change every occurrence of .map() by hand.

The Angular update side suggests

rxjs-5-to-6-migrate -p src/tsconfig.app.json

for migrating to rxjs 6, but I am afraid that this can't change my code.

Any suggestions on how to save time and change from .map() to .pipe(map()) automatically?

Upvotes: 8

Views: 16408

Answers (1)

David Bulté
David Bulté

Reputation: 3109

Maybe this can help?

I followed all steps in https://update.angular.io/, but somehow at the end of chain I had the same problem you have: all my rxjs imports were changed, but the operators hadn't been changed to pipeable operators.

Then I noticed that the rxjs-compat package hadn't been installed (due to https://github.com/angular/angular-cli/issues/10631?). After installing rxjs-compat manually (npm install rxjs-compat --save) and running rxjs-5-to-6-migrate -p src/tsconfig.app.json again, the pipes appeared!

Upvotes: 5

Related Questions