Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Community Questions TypeScript and Compile-to-JavaScript Languages

Community Questions TypeScript and Compile-to-JavaScript Languages

This item in japanese

Microsoft generated a stir in the JavaScript community with the introduction of its programming language TypeScript. This recent offering from Redmond renders JavaScript by interpreting a proprietary, type safe language, allowing a developer to leverage JavaScript functionality while reducing the need to master JavaScript itself. The software community has had mixed reactions to this new language, with some embracing TypeScript’s way of writing type safe JavaScript and others questioning the existence of the entire compile-to-JavaScript genre.

Initially, much fanfare from .Net-friendly news sources such as DevProConnections accompanied TypeScript’s release. Michael K. Campbell, a regular contributor to the DevProConnections website, offered a fair, but positive stance on TypeScript’s future. Campbell concludes that this style of application development represents the logical maturation of JavaScript, and TypeScript should be seen as a formal announcement to safely take JavaScript from the browser and introduce it to the desktop and back-end services.

I can't help but think there's a bright future in store for TypeScript. I'm particularly excited by TypeScript's future when I think about how web development trends are moving increasingly toward architectures that heavily leverage JavaScript for dynamic in-page rendering against API-enabled back-end web servers such as Microsoft's ASP.NET Web API framework.

Developers wishing to take advantage of JavaScript without having to invest a significant amount of time have found other reasons beyond type safety to adopt TypeScript. TypeScript offers a class-based object-oriented programming model which appeals to developers of C# and Java-style languages. Danny Tuppeny, a Cheshire, England based software developer, writes that this feature of TypeScript allows him to leverage JavaScript without having to master the underpinnings of the prototype-based object-oriented language.

I don't know a huge amount of Assembly or IL. Sure, there might be situations where knowing more of them would be useful, but is it really worth the time investment when I could instead be improving my C#/other skills that I use every single day?
Does it matter if I can't type JavaScript without looking it up to hook up subclass prototypes in JavaScript if TypeScript can do it for me? No. Does it help if I understand the generated code? Sure. Is it a requirement? No. All that matters is I understand how it behaves and any limitations of it. The same way I don't need to understand 100% of the IL generated when I write C#.

However, TypeScript is only the most recent entrant into the genre of compile-to-JavaScript development languages. Dart was introduced last year as a way to circumvent the shortcomings of JavaScript and enable a more robust and productive development experience on the web. While both languages share a more robust programming syntax than JavaScript, including type safety, the similarities between the two languages stop far short of having either one labeled a clone of the other language.

Scott Hanselman, a Microsoft Architect in Web Developer Tools, not only promotes the case for TypeScript, but also questions the need to compare it to Dart, noting that they are developed in a different manner and are fundamentally different at their core.

People have compared TypeScript to Dart. That's comparing apples to carburetors. TypeScript builds on JavaScript so there's no JS interop issues. Dart is a native virtual machine written from scratch. Dart interops with JavaScript...but it's not JS. It doesn't even use the JavaScript number type for example.

Shannon -jj Behrens, a developer on the Dart team, furthers this distinction by welcoming TypeScript to the family of compile-to-Java languages. The Dart team sees TypeScript as an adopter of older and buggier technology due to its reliance on JavaScript, a competitor which they believe they will soon surpass. This may explain their encouragement of Microsoft to continue to build around the JavaScript codebase.

Now that we’ve had a chance to take a look at TypeScript, the Dart team would like to welcome the TypeScript team to the neighborhood. If you already have a large JavaScript codebase, and if you already use Visual Studio, we think that TypeScript could be a great addition to your project.

But not everyone embraces the idea of replacing JavaScript or even rendering JavaScript via a different language. Nicholas C. Zakas, a web software engineer and blogger for, questions whether or not compile-to-JavaScript languages are even worth learning; when a relatively similar investment in JavaScript can yield the same result.

I see compile-to-JavaScript languages as a barrier to that goal. We should be convincing more people to learn JavaScript rather than giving them more options to not write JavaScript. I often wonder what would happen if all of the teams and companies who spent time, energy, personnel, and money to develop these alternatives instead used those resources on improving JavaScript and teaching it.

Marco van Hylckama, senior UI prototyper for Yahoo, is echoes the feelings of many JavaScript developers who would prefer the industry to focus on existing technologies simply leave JavaScript development to the JavaScript language itself. Via his Twitter account, Hylckama questions the need of TypeScript and the entire category of compile-to-JavaScript languages.

Please no, no...  Why the hell would I want to code in another language to have it compiled into Javascript? *sigh*

Approaching the topic from a different angle, the corporate Twitter account for Neave Interactive, a London based UI development firm, questions whether learning JavaScript is difficult enough to warrant its replacement or abstraction via compile-to-JavaScript alternatives.

Is JavaScript really that scary? CoffeeScript, Dart, and now TypeScript @TypeScriptLang” increase

While all of its proponents, detractors, and competitors are voicing their opinions, it cannot be disputed that TypeScript has entered an increasingly popular area of software development. JavaScript is now being considered as a viable solution for not only front-end web experience, but also for creating desktop applications, and reliable server-side products as well. Mark Johnson, an author for OSS Watch, notes how this swell of opportunity for JavaScript will likely reinforce the need for more JavaScript developers and as this need rises, the adoption of languages such as TypeScript and Dart will grow accordingly.

With the plethora of tools for writing cross-platform games and apps with JavaScript, as well as platforms such as Windows 8 and Open WebOS bringing web technologies to the desktop, demand for the features offered by TypeScript is only going to increase.

Rate this Article