This project is read-only.

Tooling available to automatically resolve and order TypeScript dependencies with (or without) _references.ts?

Topics: General
Jan 13, 2014 at 6:25 AM
Just posted this question over at SO:

Curious if there are plans/thoughts to put this on the roadmap.

Jan 13, 2014 at 9:07 AM
I think a much simpler approach would be to use external modules with require.js. Then you don't even need to think about references but you have both - separate small files during development and one concatenated file after build.

When using external modules (import X = require('X')) TS compiler automatically compiles other modules into separate files and finds all referenced files. After compiling ts -> js you can use require.js to concatenate and minify all used files.

I built a sample application to demonstrate this approach. It uses grunt to execute tasks:
Jan 13, 2014 at 4:09 PM
Thanks for the feedback. Jumping to external modules (skipping internal ones altogether) actually sounds more complicated to me, if I'm just trying to stay with the "namespace-like" internal modules and use the VS tooling to "see" all classes in the namespace. Perhaps I'm caught in a void here - haven't really tried to deal with external modules yet (just getting started with the language); seemed to understand from the documentation that you could/should stay with internal ones if you don't need more than that.
Jan 14, 2014 at 9:22 AM
When I started working with TypeScript I also chose internal modules but honestly I had the exact same problem as you have - references dependency hell :)

As I've been using require.js previously (and it's good in keeping JavaScript dependencies clean and separate) switching to external modules was not a problem for me. TypeScript makes it even easier and more readable than AMD modules in JavaScript. But I understand it's more work to understand and setup at first.

I wonder what kind of workflow is used by the bigger Microsoft projects that use TypeScript (for example the Windows 8 apps).
Jan 14, 2014 at 2:38 PM
Thanks - appreciate the advice. I wonder the same...perhaps when we're post-1.0, we'll see some samples for guidance on larger application structures.