I recently experienced a potential name collision issue, as I inadvertently created a class with the same common name Message
that already exists in PrimeNG:
import {Message} from "primeng/primeng";
import {Message} from "./dto";
Since it was my own code, I was able to easily resolve the conflict by renaming my class to something unique (such as MessageDTO
). However, if this had been an external class, I would have faced a more challenging situation.
Is there a way to import a class using an alias or any other method to manage name conflicts? In Java, you can reference a class using its fully qualified name instead of importing, although this is not ideal. How is this handled in Angular 2/TypeScript?