HTML5 Zone is brought to you in partnership with:

Eric is living in Chapel Hill, NC. By night, he writes and edits science fiction. On weekends, he spends too much time making plumbers hop on things. Eric has posted 249 posts at DZone. You can read more from them at their website. View Full User Profile

TypeScript: Microsoft’s New Take on Javascript, from the Creator of C#

10.02.2012
| 8868 views |
  • submit to reddit

Microsoft started October with a bang, unveiling Anders Hejlsberg’s newest creation: TypeScript, a superset of Javascript aimed at making the language’s big jobs easier. Key features of TypeScript include:

S. Somasegar, corporate vice president of Microsoft’s Developer Division, writes:

During the past five years, JavaScript speed has doubled every nine months (as measured by the WebKit SunSpider JavaScript benchmark.) With HTML5, the standard web platform has become significantly more compelling for delivering rich user experiences. At the same time, the reach of JavaScript has continued to expand, going beyond the browser to include native device apps (e.g. Windows Store apps for Windows 8), applications in the cloud (e.g. node.js running on Windows Azure), and more. With these developments, we’re starting to see applications of unprecedented size written with JavaScript, despite the fact that creating large-scale JavaScript applications is hard. TypeScript makes it easier.


Somasegar went on to state that “All Javascript code is TypeScript code” -- so any Javascript framework or library should work with TypeScript, and any line of Javascript entered into TypeScript’s compiler should run as expected. The source code for that compiler is available now, and Microsoft has made TypeScript available on Codeplex under an Apache 2.0 open-source license.

So how does TypeScript differ from CoffeeScript and Dart?

TypeScript prioritizes syntactical similarity to Javascript, making it much closer to core JavaScript than Dart. And although it compiles into JavaScript like CoffeeScript, TypeScript seems less interested in encouraging Javascript best practices; TypeScript is all about adding functionality and making large scale JavaScript applications. 

What I think is most interesting about TypeScript is the fact that it draws heavily on specs from the ECMA committee's next iteration from JavaScript -- so TypeScript is like a tool for using JavaScript the way we'll be able to in the future, when the new standards finally catch up. 

You can watch Anders Hejlsberg introduce TypeScript here:

So what do you think? Will you be using TypeScript to develop Javascript apps? Does it seem more compelling than CoffeeScript or Dart, or roughly the same?

Published at DZone with permission of its author, Eric Gregory.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Mark Unknown replied on Tue, 2012/10/02 - 9:33am

I might use it. The biggest drawback is that there is no Eclipse/Netbeans/IntelliJ plugin. Yet. 

I am very interested in Dart, but i am concerned about its future. So that would apply somewhat to TypeScript. But something needs to make JavaScript 'better'.   

Gusts Kaksis replied on Tue, 2012/10/02 - 10:33am

One thing, I quite didn't like is the way function return type get's declared. It all looks familiar from the begining to Action Script 3 except that one.

Pavel Savara replied on Wed, 2012/10/03 - 5:11pm

@Mark, vote here ;-) 

http://youtrack.jetbrains.com/issue/WI-13714

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.