Introduction to TypeScript

What it is ?

In simple words,Typescript is a superset of javascript. That means it is javascript plus so much more options for developers. It is pure Object Oriented and strongly typed like C# and java and it compiles to plain javascript.

Typescript has good tooling and debugging support and programmers coming from OOP(Object Oriented Programming) background find it very easy to use. They can learn it quick, debug & manage code easily and develop application faster.

It is portable and it doesn’t need any dedicated runtime environment to execute. It uses basic building blocks from javascript and all Typescript code is converted to javascript to execute. Any existing javascript library can consume TypeScript code and any Typescript code and use existing javascript library.

Benefits

TypeScript solves a major issue Javascript has, Debugging. Since javascript is an interpreted language,it needs to run code to check if its valid and the problem here is : No output in case of error. That means you write a code and even it has a syntax error it will try to run won’t produce anything.  TypeScript code is compiled first and it has error-checking feature so it will generate error if it sees any kind of syntax error.

TypeScript can use any existing javascript library using its “type definition” feature. Its definition file(.d.ts) provides definition to external javascript libraries.

It’s object oriented so it supports concepts like classes, objects, inheritance and Interfaces etc.

Components

Language:  it comprises syntax, types, keywords other programming structures

Compiler : TypeScript Compiler(tsc) converts TypeScript code to Javascript and supports all compile time activities

Language Service : The TypeScript Language service supports all editor like operations like code formatting, auto completion, syntax error, code highlighting, colorization etc.