What's new in TypeScript 2.5 RC

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

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.

Visual Studio Code 1.30 Released

The solution has received new features, as well as improved support for JavaScript and TypeScript
14 December 2018   39

Microsoft has released the development environment Visual Studio Code 1.30. The tool has received new features, as well as improved support for JavaScript and TypeScript.

The search tool in the new version of the editor allows you to make multi-line queries. You can add a new line to the query by pressing Shift + Enter or simply by pasting text from the clipboard.

Custom headers and menu items in Linux are now activated by default. Since some menus may go beyond the boundaries of the screen, the developers added the ability to scroll.

Menu items designed to work with the settings have been moved to the title bar of the editor.

In the snippet, new comment variables are implemented, allowing to leave lines or blocks of notes based on the language of the code.

Also, the developers added the Go to Declaration and Peek Declaration commands to Visual Studio Code 1.30 in addition to the existing Go to Definition and Peek Definition. This is due to the fact that in some languages ​​the concepts of definition and declaration are fundamentally different.

In Visual Studio Code 1.30, you can work with TypeScript 3.2.2. Display of callbacks in JavaScript and TypeScript is improved. The new version of the editor displays which function they belong to.

The developers have improved the integration with the repository. In the new version of the program, you can change the tool that opens the file by clicking on the version control panel.

The Visual Studio Code 1.30 error detection and removal tool allows you to delete debug consoles for inactive sessions. Improved concept of variable substitution in launch.json configuration. The initial debug configuration itself has been simplified by hiding minor elements and adding a Quick Pick interface.

You can set the task to run automatically when you open the project folder. In addition, several new tasks have been added to the task management command section, for example, Tasks: Rerun Last Task, which allows you to restart the previous process.