TypeScript is a superset of JavaScript that has been in the community for a few years now, it is currently on GitHub and before that the project could be reviewed and downloaded from CodePlex. The promise of TypeScript is that it offers JavaScript semantics along side concepts like classes, modules, and interfaces. These features are available at development time, but are ultimately compiled into simple JavaScript.

DuoCode

DuoCode is itself a C# compiler powered by Rosalyn and seems to be side stepping TypeScript completely by allowing you to compile to JavaScript directly from C# 6.0! The obvious weakness for TypeScript, in hindsight, is that it forced you to learn a JavaScript like language in order to get the features you were missing in C#. Why not just avoid the middle man completely!

It sounds to good to be true but you can try this out right now in your browser here, the following image is a simple hello world example, but feel free to experiment. DuoCode supports Method overloading, Events and delegates, Attributes, Interfaces, Extension methods, Generics, and so much more.

CSharpToJavaScript

Debugging is also not a problem here as DuoCode creates source mappings, which allow you to view and debug the original C# source files directly inside the browser (with Developer Tools) or in Visual Studio.

This really does push along the idea that JavaScript is simply the Assembly language of the Web, the only problem with that statement is that so many people continue to begin web development with JavaScript rather than assume it will be the last compilation step after development has been finished. I am a C# sycophant so I am hopeful DuoCode will push us all in the right  direction.

Related Posts



Comment Section



Comments are closed.