I want to split class definitions in a same module into multiple files. So I did like this and it worked.
a.ts:
module MyModule{
class ClassA{
}
}
b.ts:
module My Module{
class ClassB{
}
}
Then I tried to use ClassA in ClassB and did that:
b.ts:
///<reference path="a.ts"/>
module MyModule{
class ClassB{
private a:ClassA;
}
}
But it didn't work; "ClassA" needed to be "MyModule.ClassA" in b.ts though they're in the same module.
I prefer a simpler way like above. Do you have any ideas?
You can solve your problem by making the class public:
module MyModule{
export class ClassA{
}
}
I'm not sure why you need to do this as really they are part of the same module - but this seems to be the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With