What's new in TypeScript 2.5 RC

Overview of three new features of TypeScript 2.5 RC
21 August 2017   1843

TypeScript 2.5 RC was released. Let's see what's inside.

What's news?

Optional catch binding parameters

TypeScript 2.5 introduces a late-stage ECMAScript feature to make the catch binding optional in try/catch statements. That means we can just omit unusedError altogether:

let contents;
try {
    contents = fs.readFileSync('.config_file').toString('utf8');
}
catch {
    // File might not exist, just fall back to some defaults.
    contents = createDefaultContents();
}

Deduplicated and redirected packages

When importing using the Node module resolution strategy in TypeScript 2.5, the compiler will now check whether files originate from “identical” packages. If a file originates from a package with a package.json containing the same name and version fields as a previously encountered package, then TypeScript will redirect itself to the top-most package. This helps resolve problems where two packages might 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 --preserveSymlinks compiler flag

TypeScript 2.5 brings the preserveSymlinks flag, which parallels the behavior of the --preserve-symlinks flag in Node.js. This flag also exhibits the opposite behavior 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).

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.

How to install? 

You can get it by NuGet or by the following command with npm

npm install -g typescript@rc

Visual Studio 2015 users with update 3 can get it here, and Visual Studio 2017 users can get it here. Learn more at Microsoft blog.

Frontend News Digest 04 - 10.01

Front-End Performance Checklist 2020, Firefox 72 released, new version of Node.js and more
10 January 2020   176

Greetings! I hope your week went great! Here's new frontend technologies news digest.

Learn how about V8 and how to fight memory leaks using Node and the Chrome DevTools, npm security review of 2019, Mocha, JS test network for Node update and many other interesting materials awaits for you.

Guides

  • Front-End Performance Checklist 2020

Detailed checklist has been updated once again for 2020 and now it’s filled with everything you need to consider for creating fast web experiences

  • Memory Leaks Demystified

Learn about V8 and using Node and the Chrome DevTools to track down memory leaks in this tutorial

Articles

  • Firefox 72 — our first song of 2020

New version of one of the most popular web browsers has been released, so it's time to check what it brings for the coders

  • Google Chrome to hide notification spam starting February 2020

New important upcoming feature of very popular webbrowser, that may really effect some websites

  • Self-hosting third-party resources: the good, the bad and the ugly

Check the pros, cons, underwater rocks and potentional issues in self-hosting third-partty resources

  • npm Security 2019 in Review

The report by the npm Inc’s VP of Security about the different stats related to security of the npm repo in 2019

Update

  • Node v13.6.0 (Current)

The freshest version of very popular JavaScript runtime environments

  • Mocha

JavaScript test framework for Node.js & The Browser 

Video

  • WEB SCRAPING made simple with JAVASCRIPT tutorial

  • Using Typescript with modern React