# TypeScript 7 broke your build. Run TS 6 next to it.

- Published: 2026-10-16
- Updated: 2026-10-21
- Tags: TypeScript, Tooling
- URL: https://devtrillo.com/writing/typescript-7-side-by-side/

Renovate opened a PR that bumps `typescript` to `^7.0.2`. CI goes red with this:

```text title="ncc on TypeScript 7"
ncc: Using typescript@7.0.2 (local user-provided)
Error: Module build failed (from ./node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js):
TypeError: Cannot read properties of undefined (reading 'fileExists')
    at findConfigFile (.../ts-loader.js.cache.js:38:11157)
    at getConfigFile (.../ts-loader.js.cache.js:38:10396)
```

`tsc` itself is fine. Run `npx tsc --noEmit` and it passes, faster than it ever has. What broke is everything _else_ that reaches into the compiler, and in a Node CLI or a GitHub Action that's usually your bundler.

This post reproduces the break in a two-file project, explains why it happens, and sets up TS 7 and TS 6 side by side so you get the speed without the crash. It's the setup the TypeScript team recommends, and it's two lines in `package.json`.

_Already know this? Jump to [The fix](https://devtrillo.com/writing/typescript-7-side-by-side/#the-fix-two-typescripts-one-package-json)._

## What changed in 7.0

[TypeScript 7.0](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/) landed on July 8, 2026. It's the native port of the compiler, rewritten in Go, and the numbers are real: the announcement reports full builds running 8x to 12x faster, with the VS Code codebase dropping from 125.7s to 10.6s.

The catch is one sentence in that same post:

> While TypeScript 7.0 is here, it does not ship with an API. We expect TypeScript 7.1 to ship with a new (and different) API.

For years, `require("typescript")` handed you the whole compiler: `ts.sys`, `ts.createProgram`, `ts.findConfigFile`, the lot. Bundlers, loaders, linters and test runners all built on that object. On 7.0 here's what you get instead:

```bash title="what the typescript package exports on 7.0.2"
node -e 'const ts = require("typescript"); console.log(Object.keys(ts), typeof ts.sys)'
# [ 'version', 'versionMajorMinor' ] undefined
```

Two version strings. That's the whole error from the top of the post: ncc bundles `ts-loader`, `ts-loader` calls `ts.findConfigFile(..., ts.sys.fileExists)`, and `ts.sys` is `undefined`.

<figure>
  _Image: A small black bird opens a cardboard crate stamped 'typescript 7' and holds up the only two tags inside, 'version' and 'versionMajorMinor'. A man with glasses reaches into the empty crate with a ts-loader wrench, asking 'where's ts.sys?'. A jet engine taped to the crate is labeled '~10x faster'._
  <figcaption>
    Faster than ever on the outside. Almost nothing for tools to grab on the
    inside.
  </figcaption>
</figure>

## Reproduce it

The smallest project that breaks is one TypeScript file and ncc:

```ts title="src/main.ts"
const greet = (name: string): string => `hello, ${name}`;
console.log(greet("ts7"));
```

```bash title="install TS 7 and ncc"
npm init -y
npm i -D typescript@7.0.2 @vercel/ncc@0.45.0 @types/node
```

```bash title="tsc passes, ncc doesn't"
npx tsc --noEmit                 # exits 0
npx ncc build src/main.ts -o dist
# TypeError: Cannot read properties of undefined (reading 'fileExists')
```

ncc isn't special, and it isn't broken in a way ncc can fix on its own. The maintainers [say as much](https://github.com/vercel/ncc/issues/1336): a real fix has to wait for the 7.1 API.

### Loud breaks and quiet ones

Not every tool fails the same way, and the difference comes from the `typescript` range each one declares as a peer dependency. Here's what npm reported when I checked in October 2026:

<figure>
  _Image: Two panels. Left: a black bird rings an alarm bell at a padlocked gate signed 'peer <7', labeled 'ERESOLVE at install', while a man calmly leans on the gate. Right: the bird walks through an open gate signed 'peer *' and a floorboard snaps under it, labeled 'crash at build', as the man drops a clipboard marked 'build'._
  <figcaption>
    A strict peer range stops you at the gate. `*` lets you walk in and fall
    through the floor later.
  </figcaption>
</figure>

| Tool                     | `typescript` peer range  | What you see on TS 7          |
| ------------------------ | ------------------------ | ----------------------------- |
| `typescript-eslint` 8.71 | `>=4.8.4 <6.1.0`         | `ERESOLVE` at install         |
| `ts-jest` 29.4           | `>=4.3 <7`               | `ERESOLVE` at install         |
| `ts-loader` 9.6          | `*`                      | installs fine, crashes on use |
| `@vercel/ncc` 0.45       | none (bundles ts-loader) | installs fine, crashes on use |

The loud ones are the friendly ones. If your Renovate PR fails at `npm install`, you found out early. If it installs cleanly and the build goes red, you're in the `ts-loader` row.

## The fix: two TypeScripts, one package.json

TypeScript 6 is still published, under a new name: `@typescript/typescript6`. It re-exports the full 6.0 API and ships its binary as `tsc6`, so it doesn't fight TS 7 over `tsc`.

The trick is npm aliases. You install TS 6 _under the name_ `typescript`, so every tool that does `require("typescript")` gets the old API. Then you install TS 7 under a different name, so its `tsc` binary still lands in `node_modules/.bin`:

```bash title="swap in the side-by-side setup"
npm i -D "@typescript/native@npm:typescript@^7.0.2" \
         "typescript@npm:@typescript/typescript6@^6.0.2"
```

```json title="package.json"
{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2"
  }
}
```

<figure>
  _Image: A black bird moves nameplates between two mailboxes. The old, sturdy mailbox now reads 'typescript → 6.0.3', and tools carrying 'require()' letters line up to post into it. The jet-powered mailbox reads '@typescript/native → 7.0.2', and a man pulls its 'tsc' cord._
  <figcaption>
    Same names the tools already look for, different packages behind them.
  </figcaption>
</figure>

Now check that each half went where you expected:

```bash title="who answers what"
npx tsc --version     # Version 7.0.2   <- the Go compiler
npx tsc6 --version    # Version 6.0.3
node -e 'console.log(require("typescript").version)'  # 6.0.3
```

And the build:

```bash title="ncc picks up TS 6"
npx ncc build src/main.ts -o dist
# ncc: Using typescript@6.0.3 (local user-provided)
node dist/index.js
# hello, ts7
```

`typescript-eslint` installs cleanly too, because its peer range now sees 6.0.3 sitting at `node_modules/typescript`.

Your `typecheck` script doesn't change. `tsc --noEmit` already resolves to the TS 7 binary, so CI type-checks at full Go speed while the bundler and linter keep using the compiler they know.

> **Note:** You're type-checking with 7 and transpiling with 6. For most code that's
> invisible. If 7's stricter defaults flag something 6 accepts, `tsc` will tell
> you, and that's the check you want to trust.

### Your tsconfig might break too

Separate from the API problem, 7.0 changed some defaults and turned the 6.0 deprecations into hard errors. Read the list in the announcement before you merge, but these are the ones most likely to bite:

- `strict` now defaults to `true`.
- `types` defaults to `[]`, so `@types/node` globals vanish until you write `"types": ["node"]`.
- `rootDir` defaults to `./`. If your `tsconfig.json` sits above `src`, set `"rootDir": "./src"` or your `outDir` layout changes.
- `target: es5`, `baseUrl`, `downlevelIteration` and `moduleResolution: node` are errors now, not warnings.

The aliases don't help here. `tsc` is TS 7, so the config has to be valid TS 7.

## Or skip the compiler API entirely

The aliases are a bridge. Sometimes it's simpler to stop needing the bridge.

esbuild never imports `typescript`. It strips types and bundles, which is exactly the job ncc was doing for that `main.ts`:

```bash title="same bundle, no compiler API"
npx esbuild src/main.ts --bundle --platform=node --outfile=dist/index.js
```

Pair it with `tsc --noEmit` for the actual type-checking and TS 7 is the only TypeScript in the repo, as long as nothing else imports it. For a GitHub Action that just needs one `dist/index.js`, I'd take this over the aliases.

If you can't do either yet, hold the upgrade so the PR stops reopening every week. In Renovate:

```json title="renovate.json"
{
  "packageRules": [
    { "matchPackageNames": ["typescript"], "allowedVersions": "<7" }
  ]
}
```

In Dependabot:

```yaml title=".github/dependabot.yml"
ignore:
  - dependency-name: "typescript"
    update-types: ["version-update:semver-major"]
```

> **Tip:** Give the rule a `description` that links to the 7.1 release notes. A pin
> without a reason turns into a pin nobody dares remove.

## What to watch for in 7.1

The announcement calls the 7.1 API "new (and different)". Take the "different" literally. Tools won't flip back to working the day 7.1 ships; each one has to port to the new surface, and `ts-loader`, ncc and `typescript-eslint` will land support on their own schedules.

7.1 nightlies are already on npm as `typescript@next`. If you peek inside 7.0.2's `package.json` you'll also find exports like `typescript/unstable/sync` and `typescript/unstable/ast`. The name is the warning, so don't build on them.

<figure>
  _Image: A black bird stands on a calendar page marked '7.1', holding scissors next to a blank tag labeled 'delete one alias'. A crouching man holds the tag's string and looks up at a falling note that reads '7.1 support'._
  <figcaption>
    The alias is temporary. Cut it when the support note lands.
  </figcaption>
</figure>

Until then, the side-by-side setup is the boring answer. TS 7 type-checks, TS 6 answers the tools, and when your bundler announces 7.1 support you delete one alias.
