This project is read-only.

Multifile amd modules

Topics: General
Oct 23, 2013 at 7:23 PM
I am trying to create a multifile amd module with these two files:
module SomeNameSpace {
  export class Base {}
export module SomeNameSpace {
  export class Tubo extends Base {}
Basically I want to have an amd module that is split across more than one file and compiled to a single file.
But somehow I can't find the right combination of code and compiler directives to get it compiled properly. IMO this is important for managing amd modules...
Oct 23, 2013 at 8:37 PM
TypeScript does not currently support merging external modules across files. If they are both internal modules (ie not exported at the top level) then the --out flag will allow you to merge them into one file.
Oct 23, 2013 at 9:06 PM
Yay, I really hope that this one makes it into TS asap. Looks like a very important feature for module organization (can't really think of stuffing tons of code into one file).
As per -out flag: this flag just concatenates the output, right?
BTW I did the inverse -out processing - concatenated .ts files together and then compiled one big .ts file. It works except for sourcemap information getting lost (due to the "manual" merge of .ts files).
Oct 23, 2013 at 9:22 PM
Yeah, the out flag just concatenates the files in the order provided. And yeah it's probably possibly to manually concat the exported module pieces into one file, you'll just need to make sure the semantics match your expectations. We've definitely heard this request before and spent some time trying to design it but haven't landed on a solution we like just yet.