MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
typescript
Recherche

TypeScript 5.8 reaches general availability

mardi 4 mars 2025, 00:34 , par InfoWorld
Microsoft’s TypeScript 5.8, the latest version of the company’s strongly typed superset of JavaScript, has reached general availability (GA). However, one new feature introduced at the beta stage, a limited form of checking against conditional types in return statements, was dropped from the GA release.

General availability was announced February 28. Since the beta release, which arrived January 29, TypeScript’s builders pulled back some work on how functions with conditional return types are checked. The plan now is to iterate on the feature and release it in TypeScript 5.9.

TypeScript 5.8 does add more granular checks for branches within return expressions. With these granular checks, the type system special-cases conditional expressions directly inside return statements. Each branch of the conditional is checked against the declared return type of the containing function, if one happens to exist.

TypeScript 5.8 follows the release of TypeScript 5.7 in November, which featured improved error reporting. A release candidate of TypeScript 5.8 was issued February 13.

Other new and improved features in TypeScript 5.8:

Optimizations have been introduced to improve the time to build a program as well as update a program based on a file change in either --watch mode or editor scenarios. TypeScript now avoids any array allocations that would be involved while normalizing paths. Also, when edits are made that do not fundamentally change the fundamental structure of a project, TypeScript now avoids re-validating options provided to it.

TypeScript 5.8 adds support for require() of ECMAScript modules in --module nodenext. When --module nodenext is enabled, TypeScript will avoid issuing errors on these require() calls to ESM files.

TypeScript introduces a stable –-module node18 flag. Users of Node.js 18 are thus provided with a flag offering a stable point of reference that does not incorporate certain behaviors that are in –-module next. Among these behaviors is that require() of ECMAScript modules is disallowed under node18 but allowed under nodenext.

TypeScript 5.8 introduces an –-erasableSyntaxOnly flag. When enabled, TypeScript will error on most TypeScript-specific constructs that have runtime behavior. Typically, developers will want to combine this flag with the --verbatimModuleSyntax, which ensures that a module contains appropriate import syntax, and that import elision does not take place. This addresses issues raised by Node.js recently unflagging a mode called --experimental-strip-types, which requires that any TypeScript-specific syntax cannot have runtime semantics. Thus it must be possible to easily erase or “strip out” any TypeScript-specific syntax from a file, leaving behind a valid JavaScript file.

To make computed properties have more predictable emit in declaration files, TypeScript 5.8 consistently preserves entity names (bareVariables and dotted.names.that.look.like.this) in computed property names in classes.

Developers can try out early versions of TypeScript 5.9 from nightly builds from NPM (run npm install typescript@next) or through the Visual Studio Code TypeScript Nightly extension.
https://www.infoworld.com/article/3836957/typescript-5-8-reaches-general-availability.html

Voir aussi

News copyright owned by their original publishers | Copyright © 2004 - 2025 Zicos / 440Network
Date Actuelle
mar. 4 mars - 23:25 CET