TypeScript 5.7 was announced on 22 November 2024. In checked JavaScript it reports a variable that is read inside a function but never assigned anywhere, and under module: nodenext it checks JSON imports the way Node.js loads them: with an import attribute, and through the default export only.
It also added target and lib es2024 (Object.groupBy, Promise.withResolvers), let editors find the right config file further up the folder tree, and sped up tsc's start with Node.js's compile cache.
At a glance
| Release | TypeScript 5.7 |
|---|---|
| Released | 22 November 2024, the day of its announcement on the TypeScript blog |
| Source | TypeScript 5.7 release notes |
| Examples | Every example runs through TypeScript 5.9.3 when this site is built. |
| Previous release | TypeScript 5.6 |
| Next release | TypeScript 5.8 |
What changed for JavaScript
Variables that are never assigned
TypeScript already reported a variable read before assignment in straight-line code. 5.7 also reports one read inside a function when no code anywhere assigns it (TS2454). A let with a @type and no initializer is the usual case.
/** @type {number} */
let total;
export function report() {
return total.toFixed(2);error TS2454: Variable 'total' is used before being assigned.
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} JSON imports under nodenext
Under module: nodenext, importing a .json file from an ES module needs with { type: "json" } (TS1543 without it), and the data is available only as the default export, not as named exports. That is how Node.js loads JSON.
import config from "./config.json";error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.
console.log(config.port);jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} target and lib es2024
es2024 brings the types for Object.groupBy, Map.groupBy, Promise.withResolvers and the resizable ArrayBuffer. A target older than that leaves them out unless lib adds them.
const { promise, resolve } = Promise.withResolvers();
setTimeout(() => resolve("done"), 100);
console.log(await promise);jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2024",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} Editors search further for a config file
An editor used to give a file to the first tsconfig.json or jsconfig.json it found walking up from the file, even if that config did not include it. 5.7 keeps looking for a config that does, which helps folders with their own config for tests or scripts.
Faster start with Node.js compile caching
On Node.js 22 and later, tsc uses module.enableCompileCache(), so its own code is parsed once and reused between runs. The release notes measured tsc --version at about 2.5 times faster; every run of npm run lint starts a little sooner.
What did not change
rewriteRelativeImportExtensions, the release's new emit option, rewrites .ts import paths in output. JavaScript files import .js paths already, so it does not apply to them.
Upgrade notes
From the behavioral changes:
- Add
with { type: "json" }to JSON imports in ES modules undernodenext, and read the data through the default import. - Typed arrays are generic over their buffer (
Uint8Array<ArrayBufferLike>); errors aboutBufferusually mean@types/nodeis out of date. - Under
noImplicitAnywithoutstrictNullChecks, a callback that returnsnullwhere a generic return type is expected is now an implicit any (TS7011).
Gotchas
- TS2454 for a never-assigned variable is reported where it is read, not where it is declared; the fix is usually an initializer.
Sources
- TypeScript 5.7 release notes · TypeScript handbook
- Announcing TypeScript 5.7 · TypeScript blog
Last reviewed 20 October 2026.