できない.dev

ESLint「typescript-eslint does not support TS 7.0」の原因と直し方

typescript-eslint does not support TS 7.0 は、typescript@7 で ESLint を動かすと出る。
7.0 に typescript-eslint が使う API が無いためで、npm のエイリアスで 6.0 を割り当てれば直る。

公開:

症状できない · exit 2
npx eslint src
…
Error: typescript-eslint does not support TS 7.0.
    at Object.<anonymous> (/tmp/tmp.wN54BenKbD/node_modules/typescript-eslint/dist/index.js:52:11)
    at Module._compile (node:internal/modules/cjs/loader:1929:14)
    at Object..js (node:internal/modules/cjs/loader:2060:10)
解決後できた · exit 0
npx eslint src

2026-11-06 に node:24(ESLint 10.14.0 / Node.js 24.22.2) で実際に打って取った出力。検証環境の詳細

要約

typescript-eslint does not support TS 7.0. は、typescript@7 が入ったプロジェクトで ESLint を動かすと、設定ファイルが typescript-eslint を読み込んだ時点で出るエラーだ。
7.0 の typescript パッケージには、typescript-eslint がコードを読むのに使う JavaScript の API が無い。
typescript-eslint 8.72.1 は、7.0 を見つけると自分から止まる。

ふつうは ESLint を動かす前に、npm install が ERESOLVE unable to resolve dependency tree で止まる。
typescript-eslint の peerDependencies が typescript@">=4.8.4 <6.1.0" で、7.0 を含んでいないからだ。
npm が勧める --legacy-peer-deps で入れると、このエラーに行き着く。

実行例

node:24 のコンテナで typescript@7 と typescript-eslint を --legacy-peer-deps で入れると、ESLint はこのエラーを出して終了コード 2 になった。
付けずに入れると npm install が ERESOLVE で止まり、エイリアスで 6.0 を割り当てたプロジェクトでは ESLint が 0 で通った。

$ npm install -D --legacy-peer-deps typescript@7 eslint typescript-eslint
added 96 packages in 5s
$ echo $?
0
$ cat eslint.config.mjs
import tseslint from "typescript-eslint";
 
export default tseslint.config(tseslint.configs.recommended);
$ npx eslint src
typescript-eslint does not support TS 7.0.
Please see https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0 to run typescript-eslint using the TS 6 API.
See also https://github.com/typescript-eslint/typescript-eslint/issues/10940 for tracking typescript-eslint's support for TS >=7.1
 
Oops! Something went wrong! :(
 
ESLint: 10.14.0
 
Error: typescript-eslint does not support TS 7.0.
    at Object.<anonymous> (/tmp/tmp.wN54BenKbD/node_modules/typescript-eslint/dist/index.js:52:11)
    at Module._compile (node:internal/modules/cjs/loader:1929:14)
    at Object..js (node:internal/modules/cjs/loader:2060:10)
    at Module.load (node:internal/modules/cjs/loader:1651:32)
    at Module._load (node:internal/modules/cjs/loader:1443:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
    at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:372:15)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:244:9)
    at ModuleJob.run (node:internal/modules/esm/module_job:561:25)
    at async node:internal/modules/esm/loader:647:26
$ echo $?
2
$ npm install -D typescript@7 eslint typescript-eslint
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: tmp.oo8hyfn4fy@1.0.0
npm error Found: typescript@7.0.2
npm error node_modules/typescript
npm error   dev typescript@"7" from the root project
npm error
npm error Could not resolve dependency:
npm error peer typescript@">=4.8.4 <6.1.0" from typescript-eslint@8.72.1
npm error node_modules/typescript-eslint
npm error   dev typescript-eslint@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /root/.npm/_logs/2026-11-06T06_43_00_104Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-11-06T06_43_00_104Z-debug-0.log
$ echo $?
1
$ npm install -D "typescript@npm:@typescript/typescript6@^6.0.2" "@typescript/native@npm:typescript@^7.0.2" eslint typescript-eslint
added 98 packages in 3s
$ echo $?
0
$ npx eslint src
$ echo $?
0
$ npx tsc -v
Version 7.0.2

— 2026-11-06 時点の出力

検証環境Node.js 24.22.2 / npm 11.19.1 / Python 3.11.2 / 2026-11-06 検証(ほか 2 件)
検証日
実行環境
node:24 Debian GNU/Linux 12 (bookworm)
バージョン
  • Node.js 24.22.2
  • npm 11.19.1
  • Python 3.11.2
  • Git 2.39.5
  • ESLint 10.14.0

この記事の「実行例」は、上記の環境で実際にコマンドを実行して得られた出力をそのまま掲載しています。 再現手順はリポジトリの検証スクリプトとして管理し、定期的に再実行して出力を更新しています。

解決策

1. typescript に 6.0 の API を割り当てる

TypeScript 7.0 の告知(新しいタブで開く)で案内されている方法で、npm のエイリアスを使って 6.0 と 7.0 を同じプロジェクトに入れる。

npm install -D "typescript@npm:@typescript/typescript6@^6.0.2" "@typescript/native@npm:typescript@^7.0.2"

typescript という名前には 6.0 の API を持つ @typescript/typescript6 が入り、typescript-eslint はそれを使う。
7.0 は @typescript/native という名前で入り、npx tsc で動くのは 7.0 のコマンドになる。
6.0 のコマンドは tsc6 という名前で残る。

2. typescript を 6 のままにする

7.0 の型検査の速さが今すぐ要らなければ、npm install -D typescript@6 で 6 系に戻す。
エラーに出る typescript-eslint の issue(#10940)では、API が戻る 7.1 以降での対応が追われている。

よくある原因

  1. typescript を 7 に上げた。
    npm install -D typescript で入る最新版は 7.0 系で、typescript-eslint と同じプロジェクトに置くと動かない。
  2. ERESOLVE を --legacy-peer-deps や --force で越えた。
    依存の食い違いを無視して入れても、7.0 に API が無いことは変わらない。