Microsoft unveils TypeScript

Microsoft has announced TypeScript, which it calls “a language for application-scale JavaScript development”. The new release is a “typed superset of JavaScript that compiles to plain JavaScript,” and Microsoft believes its new product hits the sweet spot in remaining open and standards-compliant but also in enabling development to be more efficient and productive.

Microsoft Technical Fellow Anders Hejlsberg said in a video on MSDN that “TypeScript is really about starting with JavaScript and then strengthening it with the features that are lacking for application-scale development […] and then building excellent tooling around those capabilities.” He explained that the language was a reaction to the big upswing in JavaScript programming over the past five years, and also to the fact that it’s hard to write large applications in JavaScript. Hejlsberg noted JavaScript was never engineered to be a programming language for large apps, and that it lacks key structuring capabilities. He added that people often write in a different language and then cross-compile, but doing so “puts you at an arm’s length from JavaScript” and makes it hard to use existing libraries, something TypeScript solves.

Open source

Perhaps predictably, there’s been some concern about Microsoft’s motives, given its actions regarding web standards in the past. However, the company’s going to great pains to ensure TypeScript is open and accessible. Steve Lucco, chief architect for JavaScript runtimes and tools for Microsoft, confirmed in the aforelinked video that there’s nothing specific to Chakra, the Internet Explorer JScript engine, in TypeKit, and confirmed the language “just produces the idiomatic JavaScript you would have written, but makes it a little easier, because of the tooling on top”.

On CodePlex, initial TypeScript reviews appeared positive, with developer Steve Fenton calling it a “great new take on the JavaScript problem”, and “the first that doesn’t assume that JavaScript is a problem in the first place”. He said TypeScript “just adds some syntactic sugar that makes the development experience more productive”.

Speaking to .net, Jack Franklin, developer at Kainos and creator of JavaScript Playground, was also broadly positive: “As always, there was an immediate backlash on Twitter, with developers critical of TypeScript. The same thing happened with CoffeeScript, but it quickly settled down and found its place in the community. I wouldn’t be surprised if the same thing happened with TypeScript. It’s clear Microsoft has invested a lot of time and energy in the project and believes it to be a worthwhile endeavour, and so I think it’s something developers should keep an eye on to see how it matures.”

Regarding Microsoft’s promises regarding TypeScript’s ability to play nicely with existing code and standards, Franklin said it was “a necessity that any new project that compiles down to JavaScript is able to support ‘plain JS’ libraries too”, otherwise it would never get off the ground. However, he did wonder about Microsoft’s comments about TypeScript allowing for usage of ‘highly-productive development tools’: “This is true, but it seems very tied into Visual Studio 2012. Perhaps the community in which TypeScript will thrive most of all is in the Microsoft developer community, but it’s too early to really say. Support for other editors will naturally grow as the project matures.”