Before I ask my question, I want to mention that I am utilizing Intellij IDEA.
In reference to this inquiry: How do you prevent naming conflicts when external typescript modules do not have a module name?
Imagine I have two Rectangle classes in different Rectangle.ts files but under different packages, for instance, src/utils/geom
and src/utils/ui
.
src/utils/geom/Rectangle.ts
includes only the method calculateSurface()
, whereas src/utils/ui/Rectangle.ts
consists of only the method display()
.
If I were to call both of these classes in a single file, I would see both methods available in the type-hinting suggestions.
import GeomRectangle = require();
import UiRectangle = require();
var geom: GeomRectangle = new GeomRectangle();
var ui: UiRectangle = new UiRectangle();
// Both methods are now accessible
ui.calculateSurface();
ui.display();
I suspect it is because both Rectangle.ts files contain exports = Rectangle
, which is likely used by Intellij IDEA to determine what suggestions to provide. Is my assumption correct? And is there a way to enable type-hinting without conflicting when using external modules with similarly named classes?