a blog for those who code

Friday, 3 April 2015

Starting with TypeScript

In this post we will be discussing about TypeScript. It a a free and open source programming language developed and maintained by Microsoft. In simple terms it is a super-set of JavaScript.

According to TypeScript, TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It can work on Any Browser, Any Host, Any OS.

PC: http://www.typescriptlang.org/

What is the need of TypeScript ?

As you all know that JavaScript is everywhere and it is the only way to write a cross-platform application today. JavaScript was intended to write small application as it lacks static typing. The more mature languages like C#, Java etc. we use key concepts like classes, modules and interfaces but in JavaScript we do not have these key concepts thus it is very hard to maintain large code bases written in JavaScript. Along with this JavaScript developers lacks a productive IDE which will allow them to do things like Go To Definition, Find All References, Re-factoring, Statement Completion etc. Thus TypeScript came into existence, with a thought to add some of the above things that are missing from JavaScript.

Why TypeScript is better than JavaScript ?

TypeScript came into existence, with a thought to add some of the missing things from JavaScript such as classes and modules and optional static typing. You might be wondering that because of this addons there might be some changes in JavaScript. A BIG NO, these key concepts are added in TypeScript without actually compromising the key value proposition of JavaScript and you still have the ability to run your JavaScript on any platform or browser. Thus TypeScript is a typed super-set of JavaScript that is when it complies it gives us plain JavaScript.

Does TypeScript works with NodeJS ?

Yes it is. Since we have explained earlier TypeScript is a typed super-set of JavaScript that means it actually starts with JavaScript. It works with NodeJS. It also works with all the existing frameworks out there like JQuery, Backbone, Underscore, Angular or Knockout. The command-line TypeScript compiler can be installed as a NodeJS Package.

Install : npm install -g typescript 
Compile : tsc filename.ts

Github Location : https://github.com/Microsoft/TypeScript/

Please Like and Share the Blog, if you find it interesting and helpful.

3 comments:

  1. Really useful site to know about new addons and code tricks in .Net and Scripting languages.

    ReplyDelete
  2. Useful list but quite limited. Found link where there are more questions, thought of sharing with your readers. http://www.talkingdotnet.com/typescript-interview-questions/

    ReplyDelete
  3. We have recently written a practical TypeScript tutorial where we demonstrate how to write an Angular controller, a directive and a service.

    This will be a good additional read to this set of articles.

    ReplyDelete

Contact Us

Name

Email *

Message *

Sponsers

Best Hosting Plans

CC License