News

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
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.