- Architecting Angular Applications with Redux,RxJS,and NgRx
- Christoffer Noring
- 79字
- 2021-08-27 19:56:15
Renaming imports
Sometimes we may get a collision, with constructs being named the same. We could have this happening:
import { productService } from './module1/service'
import { productService } from './module2/service'; // name collision
This is a situation we need to resolve. We can resolve it using the as keyword, like so:
import { productService as m1_productService }
import { productService as m2_productService }
Thanks to the as keyword, the compiler now has no problem differentiating what is what.