TypeScript release

TypeScript 5.7 for JavaScript users

  • Released 22 November 2024
  • Examples run with TypeScript 5.9

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

ReleaseTypeScript 5.7
Released22 November 2024, the day of its announcement on the TypeScript blog
SourceTypeScript 5.7 release notes
ExamplesEvery example runs through TypeScript 5.9.3 when this site is built.
Previous releaseTypeScript 5.6
Next releaseTypeScript 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.

report.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: report.js(6,10): error TS2454: Variable 'total' is used before being assigned. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. report.js(6,10): error TS2454: Variable 'total' is used before being assigned. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. report.js(6,10): error TS2454: Variable 'total' is used before being assigned. checked 21 October 2026
/** @type {number} */
let total;

export function report() {
  return total.toFixed(2);error TS2454: Variable 'total' is used before being assigned.
}
A variable that nothing ever assigns, read in a function.
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.

main.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: main.js(2,20): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. main.js(2,20): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. main.js(2,20): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. checked 21 October 2026
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);
An ES module that imports JSON without the import attribute.
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.

main.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
const { promise, resolve } = Promise.withResolvers();

setTimeout(() => resolve("done"), 100);
console.log(await promise);
target es2024: Promise.withResolvers is declared.
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 under nodenext, and read the data through the default import.
  • Typed arrays are generic over their buffer (Uint8Array<ArrayBufferLike>); errors about Buffer usually mean @types/node is out of date.
  • Under noImplicitAny without strictNullChecks, a callback that returns null where 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

Last reviewed 20 October 2026.