TypeScript 2.5 Adds Optional Catch Binding
Written by Kay Ewbank   
Monday, 21 August 2017

 The release candidate of TypeScript 2.5 is available, though just for Visual Studio and Sublime Text at the moment. Support for other editors will be added soon.


typescriptlogo

While work will continue on TypeScript 2.5, other changes such as a watch mode, and integration with other tools that have file-watching functionality, will be kept for TypeScript 2.6.

TypeScript was developed by Microsoft ,and is a superset of JavaScript that builds on the ECMAScript standard and includes support for static types. Your TypeScript code then gets transformed into clean, runnable JavaScript.

The improvements to the release candidate start with support for optional catch binding parameters. According to the TypeScript developers, this is for use on those occasions where you expect something might fail by throwing an error, but you don't particularly care what that error is. TypeScript 2.5 introduces a late-stage ECMAScript feature to make the catch binding optional in try/catch statements

The second main improvement is better handling of deduplicated and redirected packages. If you import files using the Node module resolution strategy, the compiler will now check whether they come from “identical” packages. If you import a file from a package with a package.json containing the same name and version fields as one that TypeScript has already encountered, it will redirect itself to the top-most package. This helps avoid problems where two packages contain identical declarations of classes, but which contain private members that cause them to be structurally incompatible. It also reduces the memory and runtime footprint of the compiler and language service.

The final main change to this version is the addition of the preserveSymlinks flag. This behaves similarly to the --preserve-symlinks flag in Node.js. The new flag also behaves in the opposite way to Webpack’s resolve.symlinks option (i.e. setting TypeScript’s preserveSymlinks to true parallels setting Webpack’s resolve.symlinks to false, and vice-versa).

According to the TypeScript developers:

"in this mode, references to modules and packages (e.g. imports and /// <reference type="..." /> directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to."

The release candidate is available through NuGet. 


typescriptlogo

 

More Information

TypeScript on NuGet

TypeScript On GitHub

TypeScript 2.5 RC for Visual Studio
 

Related Articles

TypeScript 2.4 Adds Dynamic Import Expressions  

TypeScript 2.3 Released

TypeScript 2.2 Adds More Code Actions

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

 

Banner


OpenAI Announces ChatGPT Canvas
10/10/2024

OpenAI has launched an extra facility for developers using ChatGPT. Canvas is described as offering a new way of working with ChatGPT to write and code.



GitHub Launches Enterprise Data Residency
30/09/2024

GitHub has announced an option offering tighter control over where data is stored to meet regional requirements. The GitHub Enterprise Cloud data residency feature will launch on October 29 for the Eu [ ... ]


More News

 

espbook

 

Comments




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

Last Updated ( Monday, 21 August 2017 )