Currently, I am working on understanding the new workflow for "_references.ts" and I feel like there is something missing when it comes to using multiple files without external modules in order to produce correctly ordered ".js" code. To start with, I took the standard "greeter" template example in Visual Studio 2013 and followed these steps:
- I moved the Greeter class to a file named greeter.ts
- I selected the "Combine JavaScript output" option in the project property page, which then became the new script target in the HTML
- I created a "_references.ts" file and manually added references to my two source files in the correct order - first "greeter.ts" and then "app.ts"
This setup compiles and runs smoothly. Thanks to TypeScript 0.9.1's feature of all .ts files referencing each other in the project, I didn't have to explicitly reference "greeter.ts" from "app.ts". Looking ahead at larger projects, this will be very helpful.
However, I can't help but think that there is more to the story (unless I'm missing something... I'm also new to JavaScript so it's possible). What about having tools automatically order the list in "_references.ts" (such as auto-generation)? It seems like Visual Studio (or the TypeScript compiler) already knows the correct ordering. As I plan to port a C# application with hundreds of classes, arranging these manually would be quite overwhelming. Is there a planned feature for this in version 1.0 or should I consider looking into third-party tools? I stumbled upon grunt-ts, does this seem like the right direction?