modularize compiler and language services


Currently, the only way to reuse parts of the typescript project is by using 'reference path' includes. In fact, the whole project source ignores the language features of external modules, import and export (possibly because the source predates the availability of these features?).

This prevents use of a module system in client code and leads to ridiculous hacks like the one used to get 'typescriptServices.js' into 'harness.ts'. Another example are editor and IDE clients of the language services.

For my own tool [discussion:405174], I have to precompile my code, putting generated .js into the repo, because I cannot just import the services from the npm module (others have the same issue: http://typescript.codeplex.com/workitem/97).

blocking: workitem/97
blocked by: more complete support for ES6 modules (currently not before 0.9.x on the roadmap.. http://typescript.codeplex.com/wikipage?title=Roadmap)
Closed Jul 28, 2014 at 11:18 PM by jonturner
As part of our move to GitHub, we're closing our CodePlex suggestions and asking that people move them to the GitHub issue tracker for further discussion. Some feature requests may already be active on GitHub, so please make sure to look for an existing issue before filing a new one.

You can find our GitHub issue tracker here:


clausreinke wrote Dec 1, 2012 at 9:55 PM

Collecting examples that could be more modular:

vm.runInThisContext(typescriptServiceFile, 'typescriptServices.js');
// Start the batch compilation using the current hosts IO
var batch = new BatchCompiler(IO);

The first hack should not be needed, and represents the need proper modularisation.
The latter direct code prevents import/include of 'tsc.ts', which has code for instantiating dependency resolution.