Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Nataliya Muriy
Marketing Content Creator - you name it, she'll write it!
Contributions by Brian Fernandes
Posted on Oct 30th 2017

If you have kept true to JavaScript (JS), using TypeScript (TS) doesn’t represent abandoning a good old friend. It’s simply moving on to its typed superset – basically, getting JS with optional static types, which gets you the best of both worlds (the JS flexibility and strengthened TS security).  If you have already enjoyed TypeScript’s capabilities, such as early bug detection, easier code navigation and completion, as well as error fixes, then you will love what TS 2.5, the latest stable version, has in store for you.

New Features in TypeScript 2.5

Optional Catch Clause Variable

So what’s new?  As outlined on the TS site, one feature is the optional catch clause variable, a new ECMAScript feature. This is great if you don’t particularly care for the error thrown – there’s no longer any need to declare an unused variable.

Do you happen to be using TypeScript to develop Angular applications? Even if you aren’t, with Angular IDE, TypeScript development is a cinch, with great features like:
  • Advanced content assist & fast validation.
  • Superior syntax highlighting & call/type hierarchies.
  • Refactoring, formatting, quick fixes & linting with TSLint.
  • Powerful debugger.
  • Configuration managed in tsconfig.json to retain compatibility with the command line, and other tools.

New Quick Fixes

There are some new quick fixes available too – if you’re used to declaring JSDoc-style types, the quick fix will suggest the appropriate TS equivalent.


There’s also a new quick which fix will correct incorrect references to the type of a property:


The attention to these aspects, this sort of mistake that you might make while coding, is impressive – kudos to the TS team!

On the refactoring front, thanks to TypeScript 2.5, in 2017 CI 10, you’ll be able to extract methods and functions from blocks of code, making it much easier to modularize and reuse your code – a staple Eclipse JDT feature which will soon be available to TypeScript developers.

Advanced Capabilities

Type Checking in JavaScript

If you have a hybrid project which contains both JS and TS source, and you are using TypeScript for type-checking in JavaScript, using JSDoc type assertions will result in more accurate validation.

The syntax is: var x = /** @type {SomeType} */ (AnyParenthesizedExpression);
An example: var bar = /** @type {string} */ (foo);

Better handling of Multiple Resolutions

TypeScript 2.5 will also alleviate the headaches caused by multiple resolutions of the same file – but only if you’re using the Node module resolution strategy. With this version of TS, you will no longer encounter trouble if two packages happen to have identical class declarations but with structurally incompatible private members. How is that achieved? Thanks to the compiler checking for file origin and redirecting to the top-most package in case the file comes from “a package with a package.json containing the same name and version fields as a previously encountered package”, as explained in this blog. Since .d.ts files from duplicate packages will not be loaded, both the memory and the compiler’s runtime footprint will be reduced.

A New Flag

Another added feature of TS 2.5, is the --preserveSymlinks flag, which functions in a similar fashion to the –preserve-symlinks flag in Node.js. As explained here, when using it, “references to modules and packages are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to”.

What’s Next

Even though TS 2.5 includes quite a few improvements, as always, work continues – there are already some plans as to what the following version will bring. Our favorite features in TS 2.6, are strict function types and some cool quick fixes. Refer to the Roadmap for further details.

As far as version 2.5 is concerned, you will be able to use it with Angular IDE, CodeMix and MyEclipse, later this week, when we release 2017 CI 9.