Can you help me out - is this a bug or am I misunderstanding the documentation?
I have two files in a namespace - you'll find a simpler version below.
The Typescript docs state that "Even though the files are separate, they can each contribute to the same namespace and can be consumed as if they were all defined in one". Therefore I would assume that a class from one file could access another file from within the same namespace even if it was not exported. (Because that would be the case if they were defined in the same place)
However, tsc complains that it can't find the name "Dispatcher". Why does this happen? Am I misunderstanding the documentation at this point? Or is it just a compiler bug? Would be a shame if it was the former, because namespace only visibility would help a lot for unit testing and encapsulating.
Code:
(code changed for simplicity. If syntax errors are present, they are caused by that):
Application.ts:
/// <reference path="Dispatcher.ts"/>
namespace Application {
export class Application {
constructor() {
new Dispatcher();
}
}
}
Dispatcher.ts:
namespace Application {
class Dispatcher { /* ... */ }
}