At BUILD 20102 Microsoft dedicated some time to discussing its new JavaScript alternative - TypeScript. Whilst it is easy to think Microsoft is trying to hijack the standards compliant nature of the web yet again, TypeScript might be a little bit different.
Microsoft is trying to address the issues seen when developing large scale (tens, even hundreds of thousands of lines of code). As Microsoft technical fellow Anders Hejlsberg said:
“We have teams and customers writing, with regularity, 100,000-line JavaScript applications, in a language you could argue was designed for 100-line applications.”
So what is TypeScript? Well firstly any code that runs in Javascript will run in TypeScript. You can copy code directly from your existing JS app and it will run right away. TypeScript has added features to JavaScript, rather than started from scratch. It aims to be a turbocharged JavaScript for the modern web site and application.
New features include “static typing,” which allows developers to specify the nature of objects (a string, a number etc.). Also added is a brand new object orientation model with classes and interfaces, very similar to those found in C++ and Java.
TypeScript is still very new, and available in the likes of Visual Studio 2012 only via a plugin. Microsoft has big plans for the future including adding features currently only seen in C#. It is certainly early days, but Microsoft is trying to address a very real problem in the scalability of JS.
Those that are interested have a few options to try it out:
- Acommandlinecompiler, installed as a Node.js package
- ApluginforVisualStudio 2012
- Or the source code for the compiler is available on CodePlex
We are pleased to annouce complete TypeScript support for all Ignite UI widgets and non-visual components, such as the DataSource.
To learn more read "Introducing TypeScript support for Ignite UI" by Angel Todorov