TypeScript – a language for application-scale JavaScript development

Microsoft recently announced TypeScript, a new language for the web to develop large JavaScript applications.
It is a superset of JavaScript, so existing JavaScript code can be used. It compiles to plain JavaScript, so it can be used with any existing browser.

Here is what Microsoft’s new language offers:

  • (optional) Static typing
  • Type inference
  • Declare-Files can enrich existing JavaScript code/libraries with types. This makes it possible to use static typing in existing libraries like jQuery.
  • Classes and class based inheritance
  • Modules – using the syntax of the upcoming JavaScript version ECMAScript 6
  • Syntax is a superset of JavaScript
  • Compiles to plain non-obfuscated JavaScript
  • Tooling
  • Language specification is licenced under the Open Web Foundation’s Final Specification Agreement (OWFa 1.0)
  • Compiler is licensed under Apache-2.0-License, sourcecode is available at Codeplex.
  • Created by Microsoft, Anders Hejlsberg (one of the creators of C#), Steve Lucco (creator of Microsoft’s JavaScript engine Chakra) and Luke Hoban (who is involved in the ECMAScript standardization).

Here is a simple code sample from the TypeScript website:

class Student {
    fullname : string;
    constructor(public firstname, public middleinitial, public lastname) {
        this.fullname = firstname + " " + middleinitial + " " + lastname;
    }
}

interface Person {
    firstname: string;
    lastname: string;
}

function greeter(person : Person) {
    return "Hello, " + person.firstname + " " + person.lastname;
}

var user = new Student("Jane", "M.", "User");

document.body.innerHTML = greeter(user);

There is a nice introductory video from Microsoft explaining the language.

If you want to have TypeScript support in the WebStorm IDE, please vote for issue WI-13714 Please add Typescript support in JetBrains’ issue tracker.

IMHO TypeScript has the potential to be a game changer, changing the way we develop large scale JavaScript applications. As it is based on JavaScript, companies can still use there existing JavaScript code and expertise.

Microsoft has worked on TypeScript for two years now, so it becomes clear why they rejected to support Google’s Dart when Google unveiled their new language one year ago – Microsoft was already working on TypeScript for one year.

Short URL for this post: http://blog.oio.de/b2Ql4
This entry was posted in Web as a Platform and tagged , , , , , , , , , . Bookmark the permalink.

2 Responses to TypeScript – a language for application-scale JavaScript development

  1. Pingback: TypeScript Plug-in for Eclipse | techscouting through the java news

  2. Pingback: An introduction to TypeScript's module system - techscouting through the java news

Leave a Reply