TypeScript 4.7 released

TypeScript 4.7 is now officially released.

Overview of new features

What's new since the beta version? 

The development team announced the stable target for Node ESM support in beta , as node12; however, given that Node.js 12 is no longer under maintenance, it's time to move on node16. This should provide newer ES module features from Node.js (like pattern trailers) , while also defaulting TypeScript to a higher target that supports top-level await.

Since beta, the syntax still works for directives; however, officials have received some feedback on it and want to reconsider the requirements and design of the feature. Only experimentally available in the nightly version of TypeScript .resolution-mode/// <reference types="..." />import typeresolution-modeimport type

After the beta, the development team became aware of API compatibility issues with #privatefields . typeofTherefore, the feature will not appear in TypeScript 4.7.

This release also includes a new preview editor command for going to source definitions. Helpful in cases where the normal Go to Definition command takes you to a declaration file instead of the actual JavaScript or TypeScript source. 

There have also been some breaking changes since beta , including strictNullChecksrules around stricter type parameter constraints in and arrow function parsing have been removed. But some seemingly innocuous changes have introduced stricter rules around generics used in JSX ...spreads and template strings.

Go to Source Definition

TypeScript 4.7 includes support for a new experimental editor command called Go To Source Definition. It is similar to Go To Definition, but never returns the result in the declaration file. Instead, it will try to find the corresponding implementation file (such as a .js or .ts file) and find the definition there -- even if these files are usually hidden.

This feature usually comes in handy when you need to see the implementation of a function imported from a library, rather than the type declaration in a file.d.ts

Object Method Snippet Completions

TypeScript now provides fragment completion for object methods. When completing members in an object, TypeScript will provide a typical completion entry for the name of the method, and a separate completion entry for the complete method definition.

More details can be found in the release announcement .

Guess you like

Origin www.oschina.net/news/197203/typescript-4-7-released