I have a project written in TypeScript and I use a task runner for building (whatever: Gulp, Jake, etc.). The TypeScript compiler i use is the one I installed from NPM:
npm install typescript
Important: As you can see there is no global -g
parameter and this is on purpose. As I need to use a specific version of the compiler with some modifications.
Calling tsc
programmatically
So I want to invoke the compiler from my Javascript file configuring my task manager:
var tsc = require("typescript");
function compile() {
tsc.compile(...); // I would like to do something like this
}
Can I do that? I have tried, but not getting much luck so far.