TypeScript: Splitting a module into multiple files

I want to split class definitions in one module into several files. So I liked it and it worked.

a.ts: module MyModule{ class ClassA{ } } b.ts: module My Module{ class ClassB{ } } 

Then I tried using ClassA in ClassB and did this:

 b.ts: ///<reference path="a.ts"/> module MyModule{ class ClassB{ private a:ClassA; } } 

But that did not work; "ClassA" should be "MyModule.ClassA" in b.ts, although they are in the same module.

I prefer a simpler method as described above. Do you have any ideas?

+6
source share
1 answer

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 they really are part of the same module, but it looks like this.

+2
source

All Articles