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 any way to make ClassA accessible to classB without adding an export
to ClassA? In other words, I want ClassA to only be accessible within the App
module, but I also want to keep my classes in separate files.
Even when the compilation is output to a single file ClassA cannot access ClassB without the export.
There isn't a way to do this. Non-exported variables in modules are generated as locals in the module closure, so they're not visible at all outside the module block itself.
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