1.TypeScript Introduction - Tutorial Rays
TypeScript

1.TypeScript Introduction

1.TypeScript Introduction

TypeScript Introduction

JavaScript was invented in 1995. The purpose of the javaScript was to work on client side and that is why its called client side programing language. JavaScript became more popular after coming of Jquery which came into being in year 2006. Till then javaScript was being used as a client side programing language. But after arrival of NodeJs the platform of javaScript got completely changed. Nodejs is a javaScript engine which is used to develop server side large user-based websites. So, after nodeJs, JavaScript get started to use as server side language(using Google’s ExpressJs).

Angularjs came into being in 2009-2010 and it become huge popular. All the application logic in Angular 1.x version was written in JavaScript(Controller part).

From above all the examples and incidents you can understand that JavaScript is a very popular Language. But the problem with JavaScript is that as the code grows, it becomes very hard to maintain. Also it become a daunting task debug the code. JavaScript is a dynamically typed language. The data type is decided at run time.This sometimes causes error. Another problem with javaScript is that it's not an object-oriented language which cannot harness the power of reusability of the code.TypeScript bridges this gap of JavaScript.

TypeScript is Javascript’s superset which is a product of Microsoft. It was developed in 2012. TypeScript was being developed for Microsoft's own project, bing map. Later it was released under general public licence. It was designed by Anders Hejlsberg (designer of C#) at Microsoft It’s an optional statically typed language which is object oriented also. It supports class, object, inheritance and interfaces also.

Why TypeScript?

Features of TypeScript

TypeScript and JavaScript. As mentioned in the above section, TypeScript is JavaScript plus more. Typescript basic building blocks of coding are based on JavaScript structure. Hence, you only need to know JavaScript to use TypeScript. All TypeScript code is converted into its JavaScript equivalent for the purpose of execution. 1. JS libraries are also Supported by TypeScript. Once the Typescript code is compiled, it can be used along with any javascript code. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and libraries. JavaScript is TypeScript. So, any valid .js file can be renamed to .ts and compiled with other TypeScript files. 2. TypeScript is platform independent. TypeScript can be used across browsers, devices, and operating systems. So, any operating system or environment that supports javascript, can run typescript also. Unlike its counterparts, for TypeScript there is no requirement of dedicated VM (Virtual Machine) or a specific runtime environment to execute. 3. TypeScript is compiled language : As you know Javascript is an interpreted language which runs on browser. Javascript code does not require any compilation.So, any mistake in the code, it becomes a daunting task to find the bug and fix it.yes browser's ‘console’ is helpful to some extent but sometimes that also is not that much handy to debug the code. The TypeScript , on the other hand has great feature called transpiler which help in run time error checking. TypeScript first compiles the code and shows error, if any. 4. TypeScript is Statically Typed language : If you have worked on javascript, you might be aware that it's a loosely typed language. Its called Loosely typed language because it does not require to data type while declaring the variable. On the other hand TypeScript is a static typing language like JAVA. But this static typing is optional also. The benefit is that with this we can better type check with the coding. 5. Object-Oriented : TypeScript supports Object Oriented Programming Concepts like classes, interfaces, inheritance, etc. So, if you are from Object Oriented programing coding background, it will be easy to understand and grasp this lang

TypeScript and ECMAScript

ECMAScript is a Standard for all scripting languages.. The current version ECMAScript is 6. The code Name for ECMAScript 6 is called "Harmony". TypeScript is also based on with the ECMAScript 6 specification. TypeScript gets its fundamental language pattern from the ECMAScript5 specification. While working with Typescript, you will see that it has javascript features but unlike Javascript, its object-oriented. And its Modules and Object oriented pattern are based on EcmaScript 6 specification. But, TypeScript has few features like generics and type annotations which is not a part of the EcmaScript6 specification.

ECMA Script in nutshell

1. ECMAScript is a Standard for a scripting languages. 2. Languages like Javascript and Jscript are in the line with ECMAScript standard. ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). 3. ECMA stands for European Computer Manufacturer’s Association.

Difference Between javaScript and TypeScript

TypeScript JavaScript TypeScript is a compiled language JavaScript is an interpreted language. TypeScript code is compiled into Native javascript No, new file is generated in this. Same source file is executed. TypeScript is a Statically Typed language(Though Optional). javaScript is a dynamically Typed language. TypeScript is object-oriented TypeScript is Object based TypeScript Supports Interfaces, classes, enum etc. There is no interface, class and enum in JavaScript. Optional parameter is possible in this. Optional parameter is not possible in this. TypeScript supports module JavaScript does not support module.

Leave a Reply

Your email address will not be published. Required fields are marked *