Skip to content

Pin TypeScript to 6.x: the 7.0 native port breaks Next.js build & typescript-eslint (blocks #499) #536

Description

@NiveditJain

Summary

Dependabot PR #499 bumps typescript 6.0.3 → 7.0.2 and turns every CI job red. TypeScript 7.0 is the native (Go) port ("Corsa"/tsgo), and its npm package is not a drop-in replacement for the JS-based 6.x line. This issue records the root cause, the reproduction, and the recommended handling so the bump isn't retried blindly.

Recommendation: stay on typescript@6.x for now, and tell Dependabot to ignore typescript major-version updates. Revisit when Next.js and typescript-eslint support the native port.

Why it breaks

The typescript@7.0.2 package ships the native compiler, not the classic JS API:

  • Its package.json exports map points the main entry "." at ./lib/version.cjs — a version stub. The classic compiler API (createProgram, transpileModule, parseJsonConfigFileContent, …) is no longer at the main entry; only an experimental subset is exposed under typescript/unstable/*.
  • lib/ contains only a thin launcher (tsc.js, getExePath.js) plus per-platform native binaries (@typescript/typescript-linux-x64@7.0.2, etc.). There is no lib/typescript.js.

Every type-aware tool in this repo consumes the classic programmatic API, so the bump breaks them.

Because package.json's prepare script runs bun run build (→ next build) on every bun install, the failure hits the very first step of all CI jobs (build, test×3, quality, docs, test-e2e), not just build.

Reproduction (on a throwaway branch, TS pinned to 7.0.2)

  1. next build fails — even with type-checking disabled. Next.js 16.2.x runs a "TypeScript config validation" step that needs the classic API. With typescript.ignoreBuildErrors: true it does skip type-checking (✓ Compiled successfullySkipping validation of types), but config validation still runs and still needs the API. Under CI=true (how CI runs) Next can't self-repair and the build exits 1. Locally it only "passed" by having Next shell out to npm install mid-build to fetch a working TypeScript — impossible under --frozen-lockfile / no-network CI.

    CI error:

    It looks like you're trying to use TypeScript but do not have the required package(s) installed.
    
  2. typescript-eslint refuses TS 7. eslint-config-next@16.2.10 bundles typescript-eslint@8.64.0, whose peer dependency is:

    peer typescript@">=4.8.4 <6.1.0"   ← doesn't allow 6.1+, let alone 7.0
    

    So bun run lint (the quality job) breaks independently of Next.

  3. The native tsc binary itself works. bunx tsc --noEmit runs on the native compiler — that's the one piece that is forward-compatible.

Blocked on upstream

A port would require released versions of Next.js and typescript-eslint that speak the native-port API. Those don't exist yet — typescript@7.0.2 only just became latest; the ecosystem is mid-migration. Nothing in this repo can bridge that gap.

Recommended handling

Now:

  • Keep typescript pinned to 6.x.
  • Add a Dependabot ignore rule so the major bump stops being re-proposed weekly:
    # .github/dependabot.yml — under the `bun` ecosystem
    ignore:
      - dependency-name: "typescript"
        update-types: ["version-update:semver-major"]
  • Close build(deps-dev): Bump typescript from 6.0.3 to 7.0.2 #499.

Later (revisit criteria): once Next.js and typescript-eslint ship native-port support. The incremental adoption path is to add @typescript/native-preview (tsgo) as a separate fast type-check tool while keeping typescript@6.x as the API the ecosystem consumes — not a straight swap of the typescript package.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions