TypeScript 5.7 Released: What Changed and Why It Matters
The Microsoft team has officially introduced TypeScript 5.7 — another major update to the popular typed programming language. The new release includes dozens of fixes, optimizations, and long-awaited features that simplify development and make code even safer. Let's break down the main changes.
Improved Branch Checking with never
One of the key innovations is smarter analysis of unreachable branches. Previously, TypeScript did not always correctly determine that code after calling a function with a return type of never is not executed. Now the compiler tracks such cases more accurately, reducing false errors and allowing cleaner constructs:
- Incorrect warnings about "unreachable code" are eliminated.
- Improved handling of exceptions and infinite loops.
- More correct behavior when using
assertNever.
New Compilation Target: --target ESNext
Support for the --target ESNext flag has been added. You can now compile code for the latest version of ECMAScript without specifying a specific number (e.g., ES2023). This is especially convenient in projects where compatibility with the latest JavaScript engine features is important. It is planned that ESNext will be automatically updated with each new TypeScript release.
Utility Types: Improvements and New Features
TypeScript 5.7 expands built-in utilities for working with types:
- NoInfer — a new alias that prevents TypeScript from automatically inferring the type from a passed argument. Helps avoid unexpected narrowing during overloads.
- Improved behavior of
OmitandPickwith conditional types and mapping. - Added stricter checking for
readonlyarrays in the context of the spread operator.
Compiler Performance Optimization
The developers have done significant work on the speed of incremental compilation. According to the team, build times in large monorepos (e.g., with thousands of files) have been reduced by 10–15%. This was made possible by:
- Caching type-checking results for unchanged modules.
- An improved module resolution algorithm.
- Optimization of working with conditional types.
Simplified JSDoc Support and Editor Updates
TypeScript 5.7 better understands JSDoc annotations — more complex patterns and union types are now supported. Autocompletion for tsconfig.json configuration files has been improved in editors (VS Code, WebStorm): hints are more accurate, and descriptions for each field are more detailed.
Other Fixes and Conclusion
The release also includes fixes for dozens of bugs related to decorators, modules, and type intersections. The update is available via npm:
npm install -D typescript@5.7TypeScript 5.7 is a balanced release that makes development more comfortable without radical breaking changes. If you use strict typing in your projects, we recommend updating soon.
Follow the news on PythonLib — we continue