Access class in the same module but in a different file

Suppose I have the following code in the following two files:

ClassA.ts

module App { class ClassA{ } } 

ClassB.ts

 module App { export class ClassB{ constructor(public ClassA) {} } } 

Is there a way to make ClassA available to class B without adding export to ClassA? In other words, I want ClassA to be available only in the App module, but I also want my classes to be in separate files.

Even when the compilation is output to a single file, ClassA cannot access ClassB without exporting.

+4
source share
1 answer

There is no way to do this. Non-export variables in the modules are generated as locales in the module closure, therefore they are not displayed at all outside the module itself.

+5
source

All Articles