Redmond Review

With TypeScript, Microsoft Embraces and Augments

TypeScript is designed to make JavaScript development scalable, something Microsoft clearly needs if it's to use JavaScript in its own work.

In my September 2012 column, "JavaScript Diplomacy", I wrote about the importance of JavaScript to Microsoft. Now, as if to add an exclamation point to those thoughts, Microsoft has released its new statically typed JavaScript superset, TypeScript. Maybe you were skeptical before, but there should be no doubt in your mind now that Microsoft is serious about JavaScript. And while my September column discussed Microsoft's use of JavaScript as an instrument of outreach, TypeScript may mark the beginning of JavaScript as an internally strategic technology as well.

TypeScript is designed to make JavaScript development scalable, something Microsoft clearly needs if it's to use JavaScript in its own work. But instead of just building some internal tooling to help in that endeavor, Microsoft created something standards-compliant and open source (under the Apache 2.0 license). And TypeScript compiles to nothing more than vanilla JavaScript that's host- and OS-agnostic.

You can learn all about TypeScript by watching an hour-long presentation on it, complete with code samples, by Anders Hejlsberg. The demos in the video make TypeScript concrete and easy to understand. The video also makes it plain that Hejlsberg -- known by many as the father of C#, LINQ and the Microsoft .NET Framework itself -- seems to be very excited about this new project. Meanwhile, Hejlsberg has never, by any outward indication, been a fan of JavaScript. So what gives?

Hejlsberg Can Read the Writing
If you look at his track record, Hejlsberg seems a keen realist. On the one hand, he was the man behind Turbo Pascal and Delphi, the latter of which was rumored to have the code name VBK, or Visual Basic Killer. On the other hand, the subsequent Microsoft dominance over Borland (and the dominance of Visual Basic over Deplhi) was incontrovertible, and helped Microsoft lure Hejlsberg to Redmond. When he got there, he made himself at home, developing technology that supported the Visual Basic visual development model while implementing language and framework concepts that he felt more comfortable with.

Fast-forward to today, and JavaScript is ubiquitous outside of Microsoft. And with the development models for Windows 8 and apps for Office and SharePoint, as well as full-on support for Node.js on Windows Server and Windows Azure, JavaScript is everywhere inside of Microsoft, too.

It's another "if you can't beat 'em, join 'em" moment. But TypeScript has static typing, type inference, classes, modules and a plug-in for Visual Studio 2012 that implements full IntelliSense. Hejlsberg is acknowledging the success and entrenched status of JavaScript but, once more, with something that implements language and framework concepts with which he feels more comfortable. It's déjà vu all over again.

Competition and Cooperation
TypeScript isn't the first open source project attempting to make JavaScript more modern, structured and suitable for large projects. Google Dart has similar ambitions, as does CoffeeScript and a lesser-known project called Opa. But Dart has its own IDE and VM, CoffeeScript isn't really typed and Opa is joined at the hip with MongoDB. TypeScript, meanwhile, is really just a thin outer layer that syntactically and aesthetically stays true to JavaScript itself and, indeed, is highly inspired by the various proposed ECMAScript 6 standards out there today.

Why is Microsoft so keen to be a good Web citizen? Maybe the company sees JavaScript today much as it saw C++ in the early 1990s. C++ had an almost completely Unix pedigree at that time, as did C before it -- all three were developed at Bell Labs, after all. But Microsoft embraced C++ for Windows development and set out to create one of the best compilers for C++ in the industry. When Visual C++ came out, it gave Microsoft major C++ credibility, as well as a better way to get its own work done and innovate further up the stack.

Could TypeScript provide comparable notoriety and opportunity? Maybe, but it needs wider IDE support. The Visual Studio 2012 plug-in and browser-based "playground" are part of a good start, as are the TypeScript sample syntax files for Sublime Text, Emacs and Vi. But I'd also like to see support for Visual Studio 2010, Visual Web Developer Express, WebMatrix and, for the home run, first-class support in Eclipse. It's only with support across the Microsoft ecosystem -- and beyond it -- that Redmond's commitment to TypeScript will be fully evident.

Of course, no matter what Microsoft does, some developers outside its ecosystem will be cautious, even cynical, about TypeScript. The company should soldier on nonetheless, and do its part to make JavaScript as productive as it is pervasive.

About the Author

Andrew Brust is Research Director for Big Data and Analytics at Gigaom Research. Andrew is co-author of "Programming Microsoft SQL Server 2012" (Microsoft Press); an advisor to NYTECH, the New York Technology Council; co-moderator of Big On Data - New York's Data Intelligence Meetup; serves as Microsoft Regional Director and MVP; and is conference co-chair of Visual Studio Live!

comments powered by Disqus

Featured

Subscribe on YouTube