Description
I currently have a setup something like this:
A.ts
module mod {
export class A {
}
}
B.ts
/// <reference path="A.ts" />
module mod.A {
export class B extends A {
}
}
But I'm getting the error in B.ts
:
A module declaration cannot be in a different file from a class or function with which it is merged.
It works fine, however, if the declarations are in the same file: Playground
In my compiler options, I'm concatenating all the files together in the output, so shouldn't it not matter that they're in different source files? Even if the output wasn't concatenated, I don't understand how the declarations being in separate files changes anything.
Basically, the structure I'm going for is that A
is going to have a lot of subclasses, and I wanted to have them all be in a module also called A
. It just makes sense organizationally to me.
Why is this not allowed? Is there a way around it?