In the This Tutorial, we are going to take a look at different snippets showing some of the features of TypeScript. In order to be able to run the snippets and play with them yourself, you’ll need to install the TypeScript compiler on your computer. Let’s take a look at how to do this.
TypeScript is best installed using Node Package Manager (npm). I’d recommend you to use npm Version 3.0.0 or newer. If you don’t have node.js and npm installed already, you can visit https://nodejs.org and follow the instructions there.
Installing TypeScript with npm
Once you have npm installed and running, verify that you have the latest version by opening your terminal window and running the following command:
$ npm –v
In order to install TypeScript 1.8, use:
$ npm install -g [email protected]
The preceding command will install the TypeScript compiler and add its executable (
tsc) as global to your path.
In order to verify that everything works properly, you can use:
$ tsc –v Version 1.8.0
The output should be similar to the preceding one, though possibly with a different version.