Skip to main content

Microsoft Announces JavaScript Rival TypeScript

S. Somasegar, Corporate Vice President of the Developer Division at Microsoft, revealed on last week Microsoft's latest answer to JavaScript: a new programming language called TypeScript. Somasegar says the new language is not only aimed at making JavaScript development scale beyond the client, but easier to create large-scale JavaScript applications.

"TypeScript is a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler," he writes. "By building on JavaScript, TypeScript keeps you close to the runtime you’re targeting while adding only the syntactic sugar necessary to support large applications and large teams."

JavaScript that's already developed can be brought into the TypeScript "world", as all JavaScript code is already TypeScript code. Programmers can literally copy-and-paste from an existing JavaScript program into a TypeScript file, he said.

In an example, Somasegar complied JavaScript code that was treated like TypeScript. The output was essentially the same JavaScript code save for a few additional whitespaces and semi-colon insertions. TypeScript also allowed him to insert a simple inline type annotation to fix a bug in the original script.

"Because of TypeScript’s closeness to JavaScript, interoperability between TypeScript and JavaScript is simple," he writes. "TypeScript not only allows users to continue using their existing JavaScript libraries, it also allows those users to get early error detection and better tooling using a declare file."

Microsoft is making the new language open-source under the Open Web Foundation’s Final Specification Agreement (OWFa 1.0). Microsoft’s implementation of the compiler is also available on CodePlex (with git) under the Apache 2.0 license. Over the next few months, the TypeScript team will continue to develop CodePlex in the open.

"TypeScript builds upon the good work happening in the TC39 committee, which determines the direction of the ECMAScript standard, the formal standard for JavaScript," he writes. "We continue to work with the committee to evolve the JavaScript language and runtime capabilities. Should the community desire us to go even further and submit TypeScript to the standards body, we’re open to that, too."

Somasegar says the new language is an early preview, and invites the community give it a test drive. That said, developers can learn more about the TypeScript project here, download an early preview, read and discuss the language specification, explore the online playground, and peruse the source of the compiler (on the TypeScript project site on CodePlex, with git). 

A 53-minute video overview can be watched here.

Contact Us for News Tips, Corrections and Feedback