- Install the TypeScript compiler:- The easiest way to install TypeScript is through npm, the Node.js Package Manager. If you have npm installed, you can install TypeScript globally (-g) on your computer by:
npm install -g typescript
You can test your install by checking the version or help.
tsc --version
tsc --help
Another option is to install the TypeScript compiler locally in your project (npm install --save-dev typescript) and has the benefit of avoiding possible interactions with other TypeScript projects you may have.
- Transpile TypeScript into JavaScript To test that you have the TypeScript compiler tsc installed correctly and a working program, open a terminal and type tsc main.ts.