
上QQ阅读APP看书,第一时间看更新
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.