What is TypeScript

Page Visited: 1175
Read Time:2 Minute, 9 Second

What is TypeScript

JavaScript is client side language, using it with nodejs has helped JavaScript to emerge has a server-side to. JS does not use Object-oriented programming and hence the codes get messier as it grows big. This is where typescript comes into play.

Typescript which was first launched in 2012. Angular Js 2.0 and 4.0 are built with this platform unlike angular js 1.0 in JavaScript. It is an open source platform built and managed by Microsoft. Typescript is a superset of JavaScript. It is pure object-oriented programming with classes, interface similar to C# or java. Typescript helps you write the code in oop and compile it in JavaScript. Typescript is a language plus some tools, it is just JavaScript with some additional features. Latest stable version is 2.8.3.

Features of Typescript

Typescript starts with JS and ends with JS. The basic building blocks are from JS, hence you only need to know JS to use Typescript. All TypeScript code is converted into its JavaScript equivalent for the purpose of execution.

All JS libraries are supported by Typescript. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and libraries.

You can convert any valid .js file to .ts by renaming the file and can be compiled with other TypeScript files.

TypeScript is portable across browsers, devices, and operating systems. It can run on any environment that JavaScript runs on.

Benefits of TypeScript

The TypeScript transpiler provides the error-checking feature. TypeScript will compile the code and generate compilation errors, if it finds some sort of syntax errors. This helps to highlight errors before the script is run.

TypeScript supports Object Oriented Programming concepts like classes, interfaces, inheritance, etc.

TypeScript comes with an optional static typin.

Components of TypeScript

Language − It comprises of the syntax, keywords, and type annotations.

Compiler − The TypeScript compiler (tsc) converts the instructions written in TypeScript to its JavaScript equivalent.

Language Service − exposes an additional layer around the core compiler pipeline that are editor-like applications.

Installing TypeScript

There are two ways

  • Via npm (the Node.js package manager)
  • By installing TypeScript’s Visual Studio plugins

Visual Studio 2017 & 2015 Update include TypeScript by default. If you didn’t install TypeScript with Visual Studio, you can still download it.

For NPM users, first install node.js and npm by clicking here. You can install npm using this code

> npm install npm@latest -g

Now using this code install typescript

> npm install -g typescript

After this follow the steps for your first typescript example here.

About Post Author

Girish

Hello Guys I am a website developer by profession but is always keen on learning new things. I have been investing in Mutual funds, stock market for the past few years because of which I have gained good knowledge. I started my entrepreneur journey in 2019 which lead me to learn more things as I am moving forward. I always love to share whatever I learn. Always had a craze for cars from my childhood, which inspired me to start this website.
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Girish

Hello Guys I am a website developer by profession but is always keen on learning new things. I have been investing in Mutual funds, stock market for the past few years because of which I have gained good knowledge. I started my entrepreneur journey in 2019 which lead me to learn more things as I am moving forward. I always love to share whatever I learn. Always had a craze for cars from my childhood, which inspired me to start this website.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications OK No thanks