TypeScript & Visual Studio 2013: Coming of Age
Visual Studio 2013, with the latest version of TypeScript, gives you the same kind of support you've come to expect when writing code in C# and Visual Basic.
I'm sure somewhere, someone is using F# or one of the other "non-traditional" .NET languages in a production system. But those languages never seem to attract the user base of the "traditional" .NET languages, C# and Visual Basic
with one exception: TypeScript.
TypeScript, while still in beta, already has a rich ecosystem of support and, according to the TypeScript blog millions of lines of code "in the wild." I have to say those people with TypeScript code in production are braver than I am -- I'm not a "go live license" kind of guy. But, having said that, I'm developing a major application for a client using TypeScript, and it will be released as soon as the language comes out of beta.
Interestingly, Visual Studio 2013 doesn't completely support TypeScript "out of the box." Visual Studio 2013 comes not with TypeScript, but with an "Install the Latest TypeScript for Visual Studio" project template. Opening that project takes you to a site where you can download and install the current version of TypeScript (as I write this, that current version is TypeScript 0.9.5). Reusing that link should upgrade your TypeScript support as TypeScript moves toward version 1.0. There's also a TypeScript project template that generates an HTML "Hello, World" project, but I can't imagine why you'd use it. Typically, you'll be adding TypeScript files to ASP.NET projects.
For older versions of Visual Studio, you can also download the latest version of the language from the TypeScript site. And, while this column discusses TypeScript support in Visual Studio 2013, TypeScript support extends to other IDEs (part of the rich eco-system that I mentioned) and much of what I describe here might also work in Visual Studio 2012 -- I just didn't test it.
Supporting TypeScript Developers
One big change in Visual Studio 2013 is that, in the same way C# or Visual Basic files know all about the other classes in the same project, TypeScript files automatically pick up the definitions of any TypeScript classes in the same project. This is a real step forward: In previous versions of Visual Studio, odd little comments were required to tie TypeScript files together (you can add those "comment references" just by dragging TypeScript files from Solution Explorer and dropping them into your TypeScript code file).
Working with TypeScript in Visual Studio 2013 also led me to a "You don't miss the water until the well runs dry" moment: I've been missing Object Browser when working with TypeScript, without quite realizing it. As the number of classes in my TypeScript code increases, I've been using IntelliSense in place of Object Browser by typing in random items just to see what shows up in the IntelliSense dropdown lists. There's room out here for a "TypeScript Object Browser."
This is the price I pay for working with beta software. But these are all temporary problems (and may well have been resolved by the time you read this).
Overall, TypeScript gives you the support you expect from a first-class language. It's missing just two things, really: An equivalent to Object Browser and native TDD support. But still, I'm happy. As client-side development continues to become more complex, you're going to need this language. Personally, I'm in love both with TypeScript and the support for it in Visual Studio 2013. I just want more.
About the Author
Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.