- Strong Typing
- and many more
To install TypeScript locally you first need to install NodeJS in your PC. You can click on https://nodejs.org/en/ link and install NodeJS.
If NodeJS is already install in your pc then copy TypeScript command from below and run copied command in command prompt. Below command is only applicable to you current Project/folder
npm install typescript
If you want to install TypeScript globally then copy below command and execute in command prompt. -g stands for globally
npm install -g typescript
Below simple example is add two values. In this example you can see add function contains two number type argument which I define a: number.
You can compile by execute below command
npx tsc add.ts
One more file is created with same name but extension is js that is add.js
If you pass string in add function it will give error in compilation