What is TypeScript? How to install TypeScript?

Languages ​​that use static variables can provide more stability and reduce errors in code. TypeScript narrows the gap between JavaScript and traditional programming rules.

JavaScript is a unique programming language. It is built for web development and has different rules than other programming languages.

One of the notable differences is that JavaScript is dynamically entered, meaning that you don't have to declare types when creating variables. Languages ​​like C, C # and Java force you to declare variable types. These are called static variables.

Languages ​​that use static variables can provide more stability and reduce errors in code. TypeScript narrows the gap between JavaScript and traditional programming rules.

What is TypeScript?

TypeScript is a JavaScript version developed by Microsoft that introduces types of variables into code. It is not a completely new language. TypeScript has a very similar syntax to JavaScript, so it's easy to get started.

To show how similar they are, here is a line of code in both JavaScript and TypeScript.

  1. JavaScript:
 let myNumber = 10; 
  1. TypeScript:
 let myNumber: number = 10; 

When declaring a variable in TypeScript, you must also declare that variable type at the same time. This is a small change but it has a big impact.

TypeScript is a compiled language, unlike JavaScript that runs in the browser.

Although there is no additional software to download, TypeScript files are compiled into regular JavaScript files that can be used in any web application. TypeScript files are saved as .TS files .

What is TypeScript? How to install TypeScript? Picture 1What is TypeScript? How to install TypeScript? Picture 1
TypeScript is a JavaScript version developed by Microsoft

How to install TypeScript

It's easy to get started with TypeScript:

  1. Through the Node.js package manager (NPM)
  2. Install the Visual Studio plugin of TypeScript

Installing with NPM is very easy with the command line:

 > npm install -g typescript 

If you use Visual Studio 2017 or Visual Studio 2015 Update 3, you already have TypeScript included. If it is not already installed, you can download it via the TypeScript website.

4 ★ | 1 Vote