Installing tsc Typescript Compiler

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

To install the command line tsc Typescript Compiler using npm, you have to have Node and npm installed as described in previous tutorial.

Then at terminal (in Mac) or Node.js command prompt in Windows, type …

npm install -g typescript

Now you should be able to type …

tsc -v

to see what version you have.

To turn an typescript file into a javascript file, type …

tsc app.ts

And it will create app.js for you.

Or you can compile more multiple files …

tsc lib.ts app.ts

You can have it watch for all changes in directory and re-create all js files whenever ts file changes by the watch flag…

tsc -w

Ctrl-C will terminate the watch.

To create an initial tsconfig.js file which configures how typescript compiler works, type …

tsc -init

And you get a tsconfig.js file with the default settings …

typescript configuration file

 

 

 

 

 


Tags

Share This