This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Angular -How to avoid duplication of RxJS operator imports

Words
91
Reading
1 min
Listen
Play
9y

I love working with RxJS library in Angular when building Reactive app. Sometime it is really easy to forget to import them or sometime duplicate them which in return causing the application with a huge duplication code / library.

It makes sense to create a share import file for all RxJS method that you are going to use. Here is how to do it.

Lets create a typescript file under:  src/app/shared/rxjs-operators.ts 

It should look like this

Then after that, you just need to import rxjs-operators.ts once into your app.component.ts 

That's it.

Angular -How to avoid duplication of RxJS operator imports | Ecency