TypeScript–new language for Javascript Development

Just two days before Microsoft has officially announced the new initiative ‘TypeScript’ – a new language for cross platform, enterprise class JavaScript application development.

Why we need it?

Typical JavaScript lacks few missing pieces for full object oriented development. Developers would not be much flexible doing object oriented development using native ‘prototyping’ in JavaScript. It is really time taking if you would like to do large scale JavaScript development using ‘prototype’ in JavaScript and even more confusing to the developer on defining the scope etc.

Instead developers would be more flexible if they could do JavaScript development like any other object oriented language like C#, Java does.

That is how TypeScript is born.

TypeScript

TypeScript is a programming language that makes it easier to write cross-platform, application scale, JavaScript that runs in any browser or in any host.  TypeScript,  is a typed superset of JavaScript that compiles your code to readable normal JavaScript, can dramatically improve your productivity by enabling rich tooling experiences, all while maintaining your existing code and continuing to use the same JavaScript libraries you already love.

TypeScript extends JavaScript syntax, so any existing JavaScript programs work with TypeScript without any changes.

TypeScript is designed for development of large applications and when compiled it produces JavaScript to ensure compatibility.

TypeScript is a language extension that adds features to JavaScript.

  • Type annotations and compile-time type checking
  • Classes
  • Interfaces
  • Modules
  • Arrow functions (Lambda functions)

Compatibility with JavaScript

TypeScript is a superset of JavaScript. By default the compiler targets ECMA Script 3 (ES3) but ES5 is also supported as optional. A TypeScript application can consume existing Javascript scripts. Compiled TypeScript scripts can be consumed from JavaScript.

Existing frameworks such as JQuery and Node.js are fully supported. Type declarations for these libraries are provided with the source code.

Supported web browsers and platforms

Any web browser on any platform can run TypeScript as it is just compiled into standard JavaScript. A script can either be precompiled into JavaScript or compiled on the fly by including the JavaScript compiler for TypeScript.

The TypeScript Compiler

The TypeScript compiler, or tsc, is written in TypeScript that can be compiled into regular JavaScript that can be executed in any JavaScript engine in any host, such as a browser. The compiler package comes bundled with a script host that can execute the compiler.

It is also available as a Node.js package that is using Node.js as a host.

The current version of the compiler supports ECMAScript 3 by default. An option is allows to target ECMAScript 5 to make use of language features exclusive to that version.

Classes, despite being part of the ECMAScript 6 standard, are available in both modes.

IDE & Tooling Support

Microsoft provides a plug-in for Visual Studio 2012 as well as basic text editor support for Sublime Text, EMACS and Vim

The TypeScript website has an interactive Playground that provides a rich coding experience.

TypeScript is Free & OpenSource

The TypeScript language specification is available under Open Web Foundation and the compiler implementation is available as Open Source.

You can find codeplex repository of TypeScript at http://typescript.codeplex.com/ 

For more information on TypeScript :

Information References & Courtesy:

Other times, you're doing some piece of work and suddenly you get feedback that tells you that you have touched something that is very alive in the cosmos. Share your feedback on this blog, it will help me improve it a lot..