TypeScript 5.0 is out now. This release brings many new features while aiming to make TypeScript smaller, simpler, and faster. Version 5.0 implements a new decorator standard, better support for ESM projects in Node and bundlers, new ways for library authors to control generic inference, extended JSDoc functionality, simplified configuration, and many other improvements .
What's new since Beta and RC?
A new difference since TypeScript 5.0 Beta is that TypeScript allows decorators to be placed before export
orexport default
after and . This change reflects discussions and consensus within TC39 (the standards body for ECMAScript/JavaScript).
Another is that the new module resolution option can only be used when the option is set to This is done to ensure that statements written in the input file are not translated into calls until the bundler parses them , regardless of whether the bundler or loader respects TypeScript's options. bundler
--module
esnext
import
require
module
While TypeScript 5.0 Beta comes with "Support for case-insensitive import sorting in editor scenarios", it was not detailed in the version update announcement, as the UX for customization is still under discussion.
The most notable change since the RC is that TypeScript 5.0 now package.json
specifies 12.20
the minimum Node.js version in . The official also released an article about the migration of TypeScript 5.0 to modules .
The specific numbers for speed benchmarks and bundle size increments have also been tweaked since the TypeScript 5.0 Beta and RC releases , although noise has always been a factor in the run. The names of some benchmarks have also been adjusted for clarity, and the package size improvement has been moved to a separate graph.
TypeScript 5.0 main features
- decorator
const
type parameterextends
Support for multiple configuration filesenums
The type has become Unionenums
--moduleResolution bundler
- Resolution Customization Flags
--verbatimModuleSyntax
- support
export type *
- JSDoc support
@satisfies
- JSDoc support
@overload
- Support for passing Emit-Specific Flags
--build
- Case-insensitive import sorting in the editor
- perfect
switch
/case
- Speed, memory and package size optimizations
- Breaking Changes and Deprecations
For details, please refer to the release announcement .