# Upgrading to TypeScript 7 while typescript-eslint still needs TypeScript 6

> TypeScript 7 has no JS API yet and typescript-eslint needs TS 6, so I installed both under npm aliases. Type check: 8.3 s to 1.5 s.

- Date: 2026-11-29
- Topics: DevOps, Performance
- Chinese original: https://kbs0830.com/blog/typescript-7-alongside-typescript-eslint

On November 22 I tried to move to TypeScript 7 for the first time and got stuck on typescript-eslint: it only supports up to 6.0, and lint broke as soon as TS 7 was installed, so I shelved it. On November 29 I checked again:

- The latest typescript-eslint, 8.74.0, still declares the peer `typescript: ">=4.8.4 <6.1.0"`
- The TypeScript 7.0 announcement is very clear: 7.0 **ships without a JS API**. One arrives in 7.1, and it will be a new, different API. The main entry point of the `typescript@7` package is a single `lib/version.cjs`
- Next.js 16.4, on the other hand, is ready: `next build` now runs the project's own `tsc` command by default (`experimental.useTypeScriptCli`) and no longer calls the JS API

So the only thing really blocking the upgrade was lint.

## First attempt: give TS 6 only to typescript-eslint

My original idea was to keep `typescript` at 7.0.2 and hand TS 6 only to the typescript-eslint packages. This site uses pnpm 11, and I tried two approaches in a scratch folder:

```yaml
# pnpm-workspace.yaml
overrides:
  "typescript-eslint>typescript": "npm:@typescript/typescript6@^6.0.2"
```

```yaml
packageExtensions:
  "@typescript-eslint/typescript-estree@8":
    dependencies:
      typescript: "npm:@typescript/typescript6@^6.0.2"
```

In the lockfile produced by both, typescript-eslint **still received `typescript@7.0.2`**. The reason is that `typescript` is a peer dependency for it, and pnpm always resolves peers from the level above, which is the project root. `overrides` and `packageExtensions` can change regular dependencies. They cannot change how a peer is resolved.

## The official way: install both and swap the names

The TS 7.0 announcement already contains the answer. Use npm aliases so that the name `typescript` stays with TS 6, and install TS 7 under a different name:

```json
{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2"
  }
}
```

- `@typescript/typescript6` is the official package of the TS 6.0 API. Its command is renamed `tsc6`, so it does not fight with TS 7's `tsc`
- The name `@typescript/native` is not arbitrary: typescript-estree 8.74 already lists it as an optional peer. Reading the source, it is only used when the experimental option `EXPERIMENTAL_backend: 'tsgo'` is set, it requires 7.1 or later, and it throws on a version mismatch. Without that option it keeps using `typescript`, which is TS 6 here

After installing, `eslint .` reports no errors across the project, and rules such as `no-explicit-any` still fire as before.

## Which tool gets which version

This setup has one cost that should be stated up front: **every tool that resolves the name `typescript` gets TS 6**.

| Where | Resolves to | Version |
|---|---|---|
| Pre-commit hook (full-project `tsc --noEmit`) | `node_modules/@typescript/native/bin/tsc` | 7.0.2 |
| Renovate PR trial run (`pr-check.ps1`) | same as above | 7.0.2 |
| typescript-eslint | `typescript` | 6.0.3 |
| Type check inside `next build` | `typescript`, which finds `tsc6` | 6.0.3 |

I only became sure of the last row after reading `getTypeScriptPackageInfo` in the Next.js source: it resolves `typescript/package.json`, and when there is no `bin.tsc` it falls back to a command named `tsc` followed by digits, so it ends up running `tsc6`. In other words, the type check inside the deploy build is still TS 6, and TS 7 is the gate before each commit. Both have to pass, so nothing is looser than before.

The hook and the trial-run script used to hard-code `node_modules/typescript/bin/tsc`, and that path had to change: in the new setup `typescript/bin/` contains only `tsc6`. I added a fallback that uses the old path when `@typescript/native` is missing. The production `node_modules` only switches to the new layout once a deploy has finished, and nobody who commits in that window should be blocked.

## Numbers

Same project, same tsconfig (2,681 files, including tests and scripts), full-project `tsc --noEmit`:

- TS 6.0.3: 8.3 s
- TS 7.0.2: 1.5 s (of which the type check itself is 0.87 s)

Both versions report 0 errors. TS 7 changes some defaults (`types` now defaults to `[]`, for example), but this project's tsconfig was already explicit, so none of them applied. To make sure it was not fast because it checked nothing, I added a file containing `const x: number = "..."` on purpose, and TS 7 reported TS2322 as expected.

## Next

Once typescript-eslint officially supports TS 7 (or the TS 7.1 API ships and typescript-eslint's tsgo backend stabilizes), the aliases can go, `@typescript/native` becomes `typescript` again, and the type check in the deploy build gets faster too.

---

Author: PINGWEI LI (李秉威, Li Ping-Wei)
Original page: https://kbs0830.com/en/blog/typescript-7-alongside-typescript-eslint
