Skip to content Skip to sidebar Skip to footer

Typescript's "combine Javascript Output Into File" Option Doesn't Infer Correct Script Order Without /// Tags

I'm working on a TypeScript solution that uses the 'Combine JavaScript output into file' option: I'll often reference an item defined in another file, for example: In MyBaseClass.

Solution 1:

Why does the IDE understand the relationship between MySubClass and MyBaseClass,

It only knows the semantic relationship. Not the runtime requirements. How you do the module loading is up to you.

Note: https://github.com/TypeStrong/grunt-ts#reference and https://github.com/TypeStrong/grunt-ts#javascript-generation

Solution 2:

I really whish this could be fixed. Typescript intellisense does not seem to have any problem at all infering the proper order. When the compiler, which has the option "Combine into one file" does not solve this, it renders larger js files upfront unreliable ... The normal response to this issue is, use dynamic loading ... that is true. But in my case, the modules which are dynamically loaded, already exist of many classes which are in seperate projects compiled into a single file. Hence the problem exists in that scenario as well ...

Solution 3:

Looks like this is now possible with TypeScript 1.8:

https://medium.com/@vivainio/with-latest-typescript-you-may-not-need-webpack-417d2ef0e773#.tcu41xsft

You need to make sure System or AMD module system is selected:

https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#concatenate-amd-and-system-modules-with---outfile

Post a Comment for "Typescript's "combine Javascript Output Into File" Option Doesn't Infer Correct Script Order Without /// Tags"