TypeScript 1.4
Written by Alex Denham   
Friday, 23 January 2015

Microsoft has announced TypeScript 1.4, with union types, type guards, and more.

When Microsoft released TypeScript 1.0 in 2014, the stated aim was to create a language that would help developers scale JavaScript projects. The improved features are included in Visual Studio 2015 CTP5, as well as being downloadable from Github.

Writing about the new version on the TypeScript blog, Microsoft’s Jonathan Turner says that the team has

“continued to build new features that help you work with more JavaScript patterns, create richer typings, and use new ES6 features.”

The addition of support for union types is designed to provide a way to handle Java functions that take a number of possible argument types.

Up to now, TypeScript has supported this by using function overloads, but this capability has been generalized so you are now allowed to specify that that a value is one of a number of different types using a union type. Once you have a value of a union type, you can use typeof and instanceof checks to use the value in a type-safe way.

Type aliases are another improvement; you can now define an alias for a type using the type keyword. The alias is exactly the same as the original type, but can be used to make your code easier to read.

A more restricted form of enums has also been added. The blog post says that “for heavy uses of enums, it’s helpful to have an even more restricted form that we know is safe to always inline. This helps with performance, code size, and with working with cases where the enum aliases themselves may not be exported. Starting with TypeScript 1.4, you’ll be able to make const enums.”

One of the main goals for the upcoming TypeScript 2.0 release is to fully support the ECMAScript 6 standard, and TypeScript 1.4 gets closer to this, with the addition of a new ES6 output mode, support for let and const, and support for ES6 template strings.

The ES6 output mode is added to the ‘--target' command line option. This now allows you to choose between ES3, ES5 and ES6 output modes.

Template strings are another area of improvement. These are special strings that can freely mix in expressions, allowing a lighter syntax when pieces of a string depend on associated values. With the 1.4 release, TypeScript now supports ES6 template strings and can also compile them down to ES3/ES5 expressions.



More Information

Announcing TypeScript 1.4


TypeScript on GitHub

Related Articles

TypeScript 1.0 Released 

TypeScript Goes Light, Moves To GitHub 

TypeScript Fully Accepted into Visual Studio 


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.



Google Resumes Transition To Manifest V3

Google has resumed the planned deprecation of Manifest V2, giving notice to Chrome extension developers that Manifest V2 extensions will be phased out as early as June 2024 in the prestable versions - [ ... ]

Microsoft Launches Secure Future Initiative

Microsoft has launched the Secure Future Initiative, a focus on improving security that includes software development, new identity protections, and faster responses to vulnerabilities.

More News





or email your comment to: comments@i-programmer.info

Last Updated ( Friday, 23 January 2015 )