Support merging classes and modules across files
See original GitHub issueI 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?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top GitHub Comments
+1
i’d like to have this, to just es6 output with typescript so then i can use clousercompiler to optimize that for es5
I kinda need this feature too. Any recent updates? Also, what would the import statements look like for importing these “distributed” class/namespace declarations?