Tagged Unions, More Literals Previewed in TypeScript 2.0 RC

This TypeScript 2.0 release candidate shows off a few new features, such as tagged unions and support for more literal types, and flexes itself beyond excludes in the config file with support for globs and includes. Bonus: It's "stable enough for general use," says Microsoft.

Microsoft made a release candidate of TypeScript 2.0 available at the end of August that goes beyond just fixes from the last beta test version. This RC debuts a few new features, such as tagged unions and additional literals support, and it flexes itself beyond excludes in the config file with support for globs and includes. Unlike most RCs, this one can be put to use without having to wait for the final version.

"This RC gives an idea of what the full version of 2.0 will look like, and we're looking for broader feedback to stabilize and make 2.0 a solid release," writes Daniel Rosenwasser, a Microsoft Program Manager for TypeScript, in a blog post. "Overall, the RC should be stable enough for general use, and we don't expect any major new features to be added past this point."

One highlight among the new features that Rosenwasser highlights is tagged unions, which "brings functionality from languages like F#, Swift, Rust, and others to JavaScript, while embracing the way that people write JavaScript today." Version 2.0 rids the use of boilerplate that was necessary to tag unique values to types with common fields.

Rosenwasser also highlights support for literal types beyond string, with support for unique boolean, number and enum member types.

One other new addition is support for glob and include fields within the TypeScript config file. TypeScript 1.6 introduced the exclude field, which was useful for excluding a list of files. Globs go a step further, allowing the use of wildcards in path names. With the addition of the new include field makes including or excluding files in the config less tedious.

TypeScript 2.0 RC is available on GitHub. It does require Visual Studio 2015 Update 3 to run.

About the Author

Michael Domingo is a long-time software publishing veteran, having started up and managed several developer publications for the Clipper compiler, Microsoft Access, and Visual Basic. He's also managed IT pubs for 1105 Media, including Microsoft Certified Professional Magazine and Virtualization Review before landing his current gig as Visual Studio Magazine Editor in Chief. Besides his publishing life, he's a professional photographer, whose work can be found by Googling domingophoto.

comments powered by Disqus


  • Top 3 Blazor Extensions for Visual Studio Code

    Some developers prefer to create applications with Microsoft's open-source Blazor tooling from within the open-source, cross-platform Visual Studio Code editor. Here are the top tools in the VS Code Marketplace for those folk, as measured by the number of installations.

  • How to Invert a Machine Learning Matrix Using C#

    VSM Senior Technical Editor Dr. James McCaffrey, of Microsoft Research, explains why inverting a matrix -- one of the more common tasks in data science and machine learning -- is difficult and presents code that you can use as-is, or as a starting point for custom matrix inversion scenarios.

  • Microsoft Engineer: 'It's Time to Move OData to .NET 5'

    Microsoft engineer Sam Xu says "it’s time to move OData to .NET 5" and in a new blog post he shows how to do just that.

  • Microsoft Goes Virtual with Developer Education in Face of COVID-19

    Like many organizations that host developer educational events, Microsoft has gone virtual amid shelter-in-place directives and a surge in remote work stemming from the COVID-19 pandemic.

  • Microsoft Enhances Low-Code Power Apps

    Microsoft's nod to the low-code movement, Power Apps, has been enhanced with a bevy of new features, including mixed reality, canvas/model support in a new mobile app, UX improvements and more.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events