I'm not sure if I'm structuring my typescript incorrectly so may be asking the wrong question here.
I've got 2 related classes 1 interfaces in separate files in the same folder.
I've wrapped them in a module because that feels like what I should do coming from C#.
This is all angularjs so it does it's own DI which might be important but probably isn't.
File 1:
export module Module1{
export interface IService{
}
}
File2:
export module Module1{
export class Implementation implements IInterface{
...
}
}
File 3 is angular code that uses the angular injected instance of IInterface. If I import File2 using require("./File2")
it works but I'd rather import the whole of Module1
, something like below, so I don't have to require each class individually (as this is obviously a simplified case).
import authModule = require('Module1');
var assetStreamApp = angular.module("[])
.run(['IInterface'], (instance: IInterface) => {
instance.doSomething();
});
Is this possible?
I don't want to have to import every file individually and then choose a different alias for each "module" to namespace the types when it feels like I should be able to do that once.
Edit: After a little more reading I think I've worked out some of the terminology. I want to use typescript internal modules in a project but also use AMD modules as split points so I can use webpack's code splitting.