I am compiling multiple TypeScript files into a single JavaScript file. Say for example they are called:
A.ts // depends on C.ts
B.ts // depends on C.ts
C.ts
When I checked the JavaScript output, I found a problem: TypeScript's __extends function failed due to being passed an undefined value.
Compilation should have been in the following order:
C.ts // because A and B depend on this respectively.
A.ts
B.ts
but unfortunately they were compiled according to their names (alphabetically) rather than in dependency order.
Note: This is a Visual Studio TypeScript compiler issue. Presumably using the command line compiler would fix this, but I would like to compile from Visual Studio.
but unfortunately they were compiled according to their names (alphabetically) rather than in dependency order
https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md
TypeScript doesn't do automatic file ordering. You should compile with some --module flag set e.g. commonjs and then let an external module loader resolve these dependency chains for you.
More : http://basarat.gitbooks.io/typescript/content/docs/project/modules.html
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