Skip to content

[chore] Modernize tsconfig + add native TS7 type-check#5472

Draft
ardaerzin wants to merge 1 commit into
ts-chore/table-consolidationfrom
ts-chore/native-tsc-trial
Draft

[chore] Modernize tsconfig + add native TS7 type-check#5472
ardaerzin wants to merge 1 commit into
ts-chore/table-consolidationfrom
ts-chore/native-tsc-trial

Conversation

@ardaerzin

@ardaerzin ardaerzin commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Context

TypeScript 7 (the Go-native compiler) went GA on 2026-07-08, ~8-12x faster on large codebases with unchanged type semantics. This PR modernizes the tsconfig so the native compiler runs cleanly, types the CSS side-effect imports it (correctly) requires, and adds an opt-in native type-check script. Both apps stay at 0 errors throughout.

Two of the three parts are production-ready changes that stand on their own; the third is an opt-in dev tool. None of it touches the enforced toolchain.

Changes

1. tsconfig modernization (oss/tsconfig.json, ee/tsconfig.json). Switched to the relative-paths, no-baseUrl form:

"baseUrl": ".",
"paths": { "@/oss/*": ["src/*", ...] }        // before
"paths": { "@/oss/*": ["./src/*", ...] }       // after (baseUrl removed)

This is the modern standard form. Classic TS 5.9 accepts it (paths resolve relative to the tsconfig dir when there's no baseUrl), and it is also what TS7 requires — 7.0 removed baseUrl (TS5102) and rejects non-relative path values (TS5090). So one change satisfies both compilers.

2. CSS side-effect import typing (oss/css-modules.d.ts, ee/css-modules.d.ts). Added ambient *.css declarations per app, mirroring the existing packages/css-modules.d.ts. TS7 requires a declaration for import "x.css" (TS2882); classic tolerated it under moduleResolution: bundler. Additive and harmless to classic.

3. Opt-in native type-check. Added @typescript/native-preview (pinned) — the isolated tsgo binary. It does NOT replace the typescript@5.9 package, so typescript-eslint and next build resolve the classic compiler exactly as before. New scripts: type-check:native (tsgo) and type-check (classic — there wasn't a standalone one; type-checking only ran via next build).

The measurement

OSS, full check to zero errors: 18.1s classic → 3.7s native (~4.9x). EE native 4.3s. Less than Microsoft's headline 12x, which is on very large codebases; this is a mid-size app.

Verification (all green)

Check OSS EE
native tsgo 0 0
classic tsc 0 0
next build exit 0, types validated
lint (typescript-eslint) exit 0

The next build and lint passes are the important ones: they prove removing baseUrl does not disturb Next's own module resolver or typescript-eslint's parser, both of which read this tsconfig.

Deferred (not in this PR)

Making native the enforced gate — CI, pre-commit, and next build's internal type-check.

The hard blocker is typescript-eslint: TS7.0 shipped without a stable programmatic API (7.1 will add a new one), and npm refuses to install typescript-eslint alongside typescript@7 at all (ERESOLVE — its peer range caps below 6.1.0). So the lint job cannot move to native until 7.1. Microsoft's bridge for this transition is @typescript/typescript6 (a tsc6 binary re-exporting the 6.0 API) — see Announcing TypeScript 7.0 and typescript-eslint#12518.

Whether next build's internal type-check is also blocked is unverified — it depends on whether Next consumes the programmatic API or shells out to the tsc binary, which I did not confirm. Either way, typescript-eslint alone is sufficient reason to keep native off the enforced gate for now. This PR makes the later flip a small change; it does not attempt it.

One preview caveat: the isolated tsgo binary is currently only distributed via the nightly @typescript/native-preview channel (post-GA, the stable native compiler ships as typescript@7, whose tsc bin would collide with typescript@5.9). It's pinned to an exact version, and it sits outside every build path, so the blast radius is a local script.

Tests / notes

What to QA

Nothing user-facing. For a reviewer: cd web && pnpm type-check (classic, 0 errors) and pnpm type-check:native (tsgo, 0 errors) both pass; pnpm build-oss still succeeds.

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 23, 2026 7:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1eaeaba-af0a-4486-ac89-24789185a941

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ts-chore/native-tsc-trial

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Two production-ready changes plus an opt-in fast type-checker, stacked on the
tsc-cleanup work. Both apps stay at 0 errors throughout.

1. tsconfig modernization (real change, toolchain-neutral). Switched oss/ee to
   the relative-paths, no-baseUrl form. This is the modern standard: classic
   TS 5.9 accepts it, and it is also what TS7 REQUIRES (it removed baseUrl --
   TS5102 -- and disallows non-relative path values -- TS5090).

2. CSS side-effect import typing (real change, additive). Added css-modules.d.ts
   per app, mirroring packages/css-modules.d.ts, so asset imports are typed.
   TS7 needs this (TS2882); classic tolerated untyped CSS under
   moduleResolution:bundler.

3. Opt-in native type-check. Adds @typescript/native-preview (the isolated tsgo
   binary -- does NOT replace typescript@5.9, so typescript-eslint and next build
   are untouched) and a type-check:native script. Usable today for a faster
   local loop: OSS check-to-zero 18.1s (classic) -> 3.7s (native), ~4.9x.
   Also adds a plain type-check (classic) script; there wasn't one.

Verified all four gates green with these changes:
  native tsgo: oss 0, ee 0    classic tsc: oss 0, ee 0
  next build oss: exit 0 (Next resolver handles no-baseUrl)
  lint oss (typescript-eslint): exit 0

Deferred (not in this PR): making native the ENFORCED gate (CI/pre-commit/next
build). The hard blocker is typescript-eslint: TS7.0 shipped without a stable
compiler API (7.1 will add one), and npm refuses to install typescript-eslint
alongside typescript@7 at all (ERESOLVE) -- so flipping the lint job to native
is not yet possible. Whether next build's internal type-check is also blocked
is unverified: it depends on whether Next consumes the programmatic API or
shells out to the tsc binary. This PR does not touch either gate; it makes the
later flip a small change and measures the win now.
@ardaerzin
ardaerzin force-pushed the ts-chore/native-tsc-trial branch 2 times, most recently from 9c0b856 to 6e344f2 Compare July 23, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant