Microsoft Previews New JavaScript-Like Programming Language TypeScript

Today Microsoft released a developer preview of TypeScript, a new JavaScript-like programming language that is translated into JavaScript so that its apps can be run in any browser. The source code is licensed under Apache 2.0 and can be found on Codeplex.

TypeScript has a syntax that is very similar to JavaScript but adds features, such as optional static typing, that Microsoft programming language guru Anders Hejlsberg says will make it easier for developers to build larger applications. It attempts to address some of the same issues that Google’s Dart programming language does, but without a radical departure from JavaScript.

Like CoffeeScript, TypeScript compiles to JavaScript, but that’s where the similarities end. Hejlsberg says TypeScript is actually largely based on the specifications of the next version of JavaScript being developed by the ECMA committee.

JavaScript started out as a simple scripting language for the Netscape browser; it was never intended to become a language for building large-scale applications. Yet the rise of the web and HTML5 have made it into the standard language for client-side development, and Node.js has proved to be a popular way of writing JavaScript applications on the server side.

Frameworks like Backbone.js, the heavily venture funded Meteor and Nodejitsu‘s Flatiron are also trying to address the issue of making it easier to develop modern JavaScript applications.

TypeScript (like CoffeeScript) will actually work with existing frameworks and libraries — any JavaScript can just be pasted into TypeScript and should just work.

Hejlsberg created Turbo Pascal, was the chief architect of Delphi, and is the lead architect of C# and LINQ. He developed TypeScript with Steve Lucco and Luke Hoban.

Here’s a list of features:

  • Optional static typing
  • Class declarations
  • Support for modules
  • A Visual Studio plugin

Asked whether Microsoft might do something to prioritize TypecSript in Internet Explorer, Lucco, the chief architect of IE’s JavaScript rendering engine Chakra, says no. Because most developers will only actually be putting TypeScript online, it’s not in Microsoft’s best interest to handicap JavaScript, and there won’t be any real way for IE to run TypeScript faster than any other browser can — apart from differences in their JavaScript rendering engines, of course.

Image credit: Dmitry Baranovskiy / CC