INTRODUCTION TO TYPESCRIPT

Often when we talk about JavaScript, somewhere someone brings TypeScript into it and I’ve seen many of us baffling like TypeScript? What really it is? I haven’t heard about it, used ? never. So in this post we will be deep diving into the basics of TypeScript and revealing aspects about it.

In this post we will be seeing

What is TypeScript?

Why TypeScript?

How to install TypeScript?

Features of TypeScript.

What is TypeScript?

TypeScript is an open source Object Oriented Programming Language developed and maintained by Microsoft. TypeScript was first made public in October 2012. TypeScript is a superset of JavaScript, it means when you write any code in TypeScript it complies into plain JavaScript code. We can create JavaScript applications for client and server side using TypeScript.

Compilation
Compilation

Why TypeScript?

We can create both client and server side application using JavaScript, then why there was need of TypeScript ?

  1. TypeScript is an Object Oriented Programming language, which possess all the features of OOPs concept hence helps to write more cleaner and robust code.
  2. TypeScript supports static type checking, thus you can find the error at compile time even before running your program thus helps to find errors.
  3. JavaScript is interpreted language while TypeScript is a transpile programming language, i.e it transforms code from a higher level programming language to another high level programming language, TypeScript transpiler helps you to find error before you run your program.
  4. When you write large scale application and multiple developers are working on the same project, it becomes complex dealing with dynamic variables, hence static type features come into picture and thus TypeScript becomes the best option.
  5. TypeScript code can be compiled as per ES5 and ES6 standards thus having latest browser support.

How to Install TypeScript?

Installing TypeScript is easy,

There are two main ways to get the TypeScript tools:

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

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

For NPM users:

> npm install -g typescript
> tsc -v
> Version 3.5.2

Features of TypeScript.

  1. Cross Platform: TypeScript can run on any platform where JS can run. TS compiler can be installed on any OS.
  2. Support to all JS Library: TypeScript support all the JavaScript elements and can reuse all of the existing JavaScript frameworks, tools, and libraries.
  3. Static Type checking: TS uses static type checking, you can do that using type annotations.
  4. DOM Manipulation: TS can be used to manipulate elements similar to JS.
  5. ES 6 Features: TypeScript includes most features of ECMAScript (ES 6, 7).

So this was introduction to TypeScript, hope you’ve got basic understanding, do ask questions in comment if you have any, you can also mail me at malviya.et@gmail.com. In this next post we will see how to write programs in TypeScript.

2 thoughts on “INTRODUCTION TO TYPESCRIPT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s