What’s new in TypeScript 2.5

The release candidate lets developers get rid of unneeded catch-binding errors, as well as bring in Node.js-like module resolution

Credit: Mira DeShazer

TypeScript 2.5, the upcoming upgrade to Microsoft’s popular typed superset of JavaScript, is now available as a release candidate. It includes an enhancement for try/catch statements for errors as well as compiler improvements.

The catch binding parameters capability in TypeScript 2.5 uses a late-stage ECMAScript feature to make catch binding optional in try/catch statements. Making catch binding optional “means we can just omit unusedError altogether,” said Daniel Rosenwasser, Microsoft’s program manager for TypeScript. The reason for that is there are times when developers expect something might fail by throwing an error, but the developer does not care what the error is.

Also featured in TypeScript 2.5:

  • Support for imports when using the Node module-resolution strategy. The compiler checks whether files originate from “identical” packages. If a file was derived from a package with a package.json containing name and version fields identical to a previously encountered package, TypeScript will redirect to the top-most package. This resolves a situation in which two packages might have identical declaration of classes but contain “private” members that make them structurally incompatible. A side effect of this change is reduction in memory and the runtime footprint of the compiler and language service.
  • The preserveSymlinks compiler flag, which is like to the –preserveSymlinks flag in Node.js that instructs the module loader to preserve symbolic links when resolving and caching modules.

Other features being considered for future TypeScipt versions include improvements to the TypeScript –watch mode and integration with other tools that have a file-watching capability. The intent is to ensure that as code bases grow larger, TypeScript offers fast turnaround between the time that a file is saved and the time to load a project.

The TypeScript 2.5 release candidate is available through NuGet and through NPM via npm install -g typescript@rc.

Join the newsletter!

Error: Please check your email address.

More about Microsoft

Show Comments
[]