Microsoft introduces TypeScript programming language

JavaScript is a familiar programming language to developers and its one of the languages that developers can use to make Windows 8-based apps. Today, Microsoft announced a new programming language which it is calling TypeScript that's designed to extend the features of the familiar JavaScript.

Microsoft has already launched the official TypeScript webpage, which includes an early version that developers can download right now to check out for themselves. In a new post on the Visual Studio blog, S. Somasegar, the corporate vice president of the Developer Division at Microsoft, talks about the growth of JavaScript among developers. Microsoft's plan with TypeScript it to make it easier for software makers to create large scale JavaScript-based applications.

Somasegar states:

TypeScript is a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler. 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. Importantly, TypeScript enables great tooling experiences for JavaScript development, like those we've built for .NET and C++ and continue to innovate on with projects like “Roslyn”.  This is true whether you’re writing client-side JavaScript to run on Windows, Internet Explorer, and other browsers and operating systems, or whether you’re writing server-side JavaScript to run on Windows Azure and other servers and clouds.

The blog states that all code written in JavaScript works with TypeScript. An example is shown in the "hello, world" example above where the code on the left side is in JavaScript ,but treated as TypeScript.  The code on the right contains the output of the TypeScript compiler for this code. Microsoft has also made TypeScript an open source language, with Somasegar saying, "The TypeScript language is made available under the Open Web Foundation’s Final Specification Agreement (OWFa 1.0), and we invite the community to discuss the language specification."

Somasegar ends the blog post by saying, "I personally am super excited about what the impact of TypeScript can be on the world of software development, particularly in a world where there is so much momentum for the web programming model. This is another important step in the journey for great tools for standards web development from Microsoft."

Source: Visual Studio blog | Images via Microsoft

Report a problem with article
Previous Story

Has Microsoft not yet approved Clover-Trail based Windows 8 tablets?

Next Story

Windows Phone 7.8 and 8.0 to feature app Share option

34 Comments

Commenting is disabled on this article.

It's weird how most people commenting understand exactly what this is (an evolution of Javascript), while the people who don't get it are being REALLY obvious about it with lame extents of sarcasm.

As pity the example won't work as most would expect: an alert of "Hello world" when the button is clicked. Instead you get an alert of "Hello [object Object]" as that was what was passed into the constructor. In any case, barring a couple of missing semicolons and whitespace that would trip JHint the code is identical...

mrbester said,
As pity the example won't work as most would expect: an alert of "Hello world" when the button is clicked. Instead you get an alert of "Hello [object Object]" as that was what was passed into the constructor. In any case, barring a couple of missing semicolons and whitespace that would trip JHint the code is identical...

The example Neowin used is the worst possible one - TypeScript has classes, modules, interfaces, static type checking, type annotations, type inference and other stuff. But that code does show "Hello World".

Aethec said,

The example Neowin used is the worst possible one

I think it's served its purpose. It's shown that it's "backwards" compatible.

"The blog states that all code written in JavaScript works with TypeScript. "

zhiVago said,

I think it's served its purpose. It's shown that it's "backwards" compatible.

"The blog states that all code written in JavaScript works with TypeScript. "


Yes, but that's not a good part of the blog to quote. If you're going to paraphrase and quote everything, at least do it correctly.

I don't see a toString override on the greet function to take the value of the message key from the greeting object passed into the constructor. Therefore the concatenation should use Object.prototype.toString which returns "[object Object]". Anything else is wrong as toString does not iterate an object's properties.

Aethec said,

Yes, but that's not a good part of the blog to quote. If you're going to paraphrase and quote everything, at least do it correctly.

Not sure the Neowin author has enough understand of the context of the story. This is why going to the source is essential. If you only follow what is posted on 'exposure' based news sites you are cheating yourself from fully understanding any story or technology being referenced.

In their defense, which I am often critical, Neowin is here to point out 'new' things, not teach you about them; hence, you should always follow the source and read the full story.

When will this JavaScript crap get old so we can go back to talking powerful production languages? Please, please let CIO Magazine tire of this endless buzzword jabbering about HTML 5 and JavaScript so that management will let the programming world move forward.

I'm pretty sure that's why this is an evolution of Javascript (hence the backwards compatibility) with the intent of allowing for more robust applications.

Joshie said,
I'm pretty sure that's why this is an evolution of Javascript (hence the backwards compatibility) with the intent of allowing for more robust applications.

It absolutely is, but it's taking a turd and putting a hat on it. Instead of getting something that's up to the job, we're to *trick* something else into doing what it was never designed to do.

Skwerl said,

It absolutely is, but it's taking a turd and putting a hat on it. Instead of getting something that's up to the job, we're to *trick* something else into doing what it was never designed to do.


It looks much better than JS. The methods will probably be the same and some quirks (==, anyone?) too, but at least it has proper classes and static typing.

Skwerl said,
When will this JavaScript crap get old so we can go back to talking powerful production languages? Please, please let CIO Magazine tire of this endless buzzword jabbering about HTML 5 and JavaScript so that management will let the programming world move forward.

You are kind of missing the whole point and the evolution of programming.

Start here...
http://en.wikipedia.org/wiki/MVVM

Moving to new programming models, makes the scripting/language far less relevant and removes the need for full languages to handle all aspects of programming.

With the advantages of a CLR and managed code that have evolved to native code speeds, dropping an entire project in something like C++ is a waste of time.

Even with non-managed and non-runtime code, even using C++ with MVVM is a generational jump in software development.

Sure JavaScript is rather low bar, but Microsoft's support since the new IE9 engine was built and incorporation of JavaScript into the ModernUI/Metro framework as a native language to work with the MVVM concepts it has relevance.

This is not because JavaScript is the 'best' or even 'powerful', but the diversity it offers as a site developer can take their site and flip it into a native HTML5 App for Windows 8 or Windows Phone very easily.

It also opens up new opportunities with HTML5/CSS3 so site developers can build RIA or Web Apps sites that run like an 'App' inside a modern browser like IE10.

Years ago I was stuck in the mindset of why are we bothering with JavaScript crap as well, until IE9 came along and Microsoft direction changed when they were getting near native performance out of JavaScript and HTML5/CSS content on a web site.

For Web Apps to have a future, other browsers need a serious overhaul, and move from a document rendering application to a runtime compiler for web content like IE9 and IE10.

(This is why IE10 is has consistent performance from an ARM/Atom CPU to the latest i7, and it is also why on many high level graphical tests, IE10 is still hitting 100x the performance of Firefox, Safari, or Chrome when dealing with complex UI and graphical sites. Even if IE10 is not nailing the best JavaScript performance, this is irrelevant because it can shove graphics and dynamic content around as fast as Chrome can with WebGL, which is NOT a standard and is very dangerous.)

This looks awesome!

I wonder if there would be any advantage to a browser natively supporting TypeScript somehow. Seems like all the type hinting in TypeScript would let it parse more quickly and compile down more completely than JavaScript code...

From the blog post: "The box on the right contains the output of the TypeScript compiler for this code, and you'll notice that this output is essentially the same JavaScript code that was input with some minor whitespace differences and semi-colon insertions:"

So that code is the compiler OUTPUT, which is essentially the same.

Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

It's not the best example (if it is even an example), go to the site for better ones.

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)
Looks that way

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)
Combine lines 7, 8, and 9 and you have a carbon copy unless I am missing something else?

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

i just spent a few mins going letter by letter to see if i was missing something obvious

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

So it's not just me?^^

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

Yeah, it's rather lame. I was hoping to see something like LISP....oh well.

wookietv said,

i just spent a few mins going letter by letter to see if i was missing something obvious

Obviously you all missed something very important! There are two additional semicolons after }.
Great way to demonstrate language's capability to add extra semicolons, MS! Now shut up and get us the surface!

Praveen Rajendran said,

Obviously you all missed something very important! There are two additional semicolons after }.
Great way to demonstrate language's capability to add extra semicolons, MS! Now shut up and get us the surface!


Wow, you did a magnificent job of sounding like you don't know what you're talking about.

Praveen Rajendran said,

Obviously you all missed something very important! There are two additional semicolons after }.
Great way to demonstrate language's capability to add extra semicolons, MS! Now shut up and get us the surface!


It's pretty clear you haven't visited the TypeScript website and actually learnt anything about the language.

sonrah said,
Is it just me, or is there no difference in the code in the two boxes above, other than formatting and semicolons (which aren't necessary in JavaScript)

That's the point. There is no difference. TypeScript compiles to JavaScript, so the left side is raw JavaScript, and the right side is the "compiled-to-JavaScript" output when compiling the TypeScript equivalent, i.e. the same thing. The right-hand side is actually the compiled version of one of the examples in the tutorial (http://www.typescriptlang.org/Tutorial/).

Majesticmerc said,

That's the point. There is no difference. TypeScript compiles to JavaScript, so the left side is raw JavaScript, and the right side is the "compiled-to-JavaScript" output when compiling the TypeScript equivalent, i.e. the same thing. The right-hand side is actually the compiled version of one of the examples in the tutorial (http://www.typescriptlang.org/Tutorial/).

+1

Is reading the actual story source too hard for people? No wonder people yammer on about crap they vaguely understand.