What is TypeScript

TypeScript  is a free and open source language which is developed and maintained by  Microsoft technologies . It was released on 2012 for first time. So initially when it was released it was only supporting for Visual studio framework(Visual studio version was 2013) that means only for windows OS. But later it was supported for all other OS like Linux , Mac etc. . Currently we have different editors like Eclipse , Webstrom, Emacs and Atom etc. where we can  create our TypeScript application.We can manages the TypeScript dependencies by two main ways
            a. By npm (node.js Package ) . You can download the Node.Js here .
            b. By TypeScript's Visual studio plugin.

Here I am giving more emphasis on TypeScript application on Visual studio.
So in Visual studio 2017 and Visual studio 2015 update 3 you will get the TypeScript by default.

If you have not installed the TypeScript  you can install it by the following npm command.

  npm install -g typescript

Definition of TypeScript : 

Then if you go to the definition of TypeScript, Simply Typescript is a optional static type Superset of Javascript and it compiles into plain Javascript by Typescript compiler.


So basically TypeScript code get compiled by the TypeScript compiler . The name of  the TypeScript compiler is tsc.
We can say its a language which have the same features like other object oriented programming languages like C++, Csharp and Java as well. So TypeScript supports the concept like Class , Inheritance , Ploymorphisim , Interface etc.

Typescript is a completely strict Superset of ECMAScript 2015 and ECMAScript 2015 is a Superset of  ES5.

So here I can say that every valid javscript code get compiled inside a TypeScript Code .
A file having the .ts extension is called a TypeScript file.

Why TypeScript: 

          There might be certain questions in your mind that  if TypeScript finally get compiled into plain javascript code then why we need to do one extra more process that is compilation.Yes you are exactly right I was also thinking same before coming to TypeScript , but we have some valid reasons like
1. TypeScript can be used for a large complex project and to make it more modular , maintainable and readable as well.
2. The most important thing that its a object oriented Programming language . It provides the features like Inheritance , Polymorphisim , Interface etc like other object oriented programming languages.
3. In jvascript we can create a object by creating a function right ,there is no such keyword Class. But if we are much acquainted with Csharp and Java like object oriented programming so we will feel bit uneasy when will write the Javascript code as because there is no such keyword Class and if we are doing the inheritance we can do it by prototype. But TypeScript will be more comfortable for us to write the code .

But here I just want to mention one thing that Javascript is always necessary and you should have Javascript knowledge before doing any TyesSript coding.


How to compile a TypeScript file  By npm command

> tsc yourfilename.ts

The result will be a file yourfilename.js which contains the same JavaScript that you fed in.

So in this blog we just got few ideas on Typescript , in our next blog we will create some typescript application. Stay tuned with me .... 

Comments

Post a Comment

Popular posts from this blog

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The transaction is aborted or Failure while attempting to promote transaction.

Unable to load one or more breakpoints in Visual studio.