What’s new in Typescript 2.5

A few days ago TypeScript 2.5 has been released and it brings us a few very nice and worth mentioning features.

The features that I like the most are Resharper-like improved refactoring options which now allow you to extract method and extract function just by selecting the piece of code to refactor and using right click. It will be for sure used a lot and improve developers productivity, making complex refactoring trivial. Well done, TypeScript team! We definitely need more options like that.

Quick fixes are other interesting features triggered by incorrect notation – TypeScript tries to guess what the developer had in mind and propose fixes to common mistakes.

If you need to write try/catch block without really caring about the thrown error type, you are now allowed to use optional catch clause. It reduces the code redundancy when you have to catch an error which is never referenced.

The compiler will now check if the files originate from identical package and in case of more packages were referenced they will redirect to top-most package. This improves the application performance by reducing the memory and runtime footprint of the compiler and language service by avoiding loading .d.ts files from duplicate packages. It also prevents hard to track errors which we could observe so far when two identical .d.ts files were referenced.

A compiler flag to preserve symbolic link –preserveSymlinks instructs the compiler to resolve modules using symlink path instead of the real path and in TypeScript 2.5 parallels the –preserve-symlinks NodeJS behavior.

How can I get it?

You can get TypeScript 2.5 through NuGet or download here to use it with VisualStudio.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.