chore: upgrade TypeScript to 7.0.2 across the workspace - #609
Conversation
Moves 11 of 12 workspace packages to TypeScript 7.0.2, the native Go compiler. Typecheck on apps/api drops from ~2.2s to ~1.1s. TypeScript 7's npm package no longer ships the JS compiler API — the main export is just lib/version.cjs, and ts.createProgram / the language service now live behind typescript/unstable/*. Any tool importing "typescript" and calling compiler APIs breaks at runtime, which is what gates the two packages that use such tools. packages/ui generated its declarations through tsup's dts option, which runs rollup-plugin-dts against the JS API. tsc emits declarations directly, so tsup now builds only the JS bundle and tsc emits the .d.ts files. This also lifts the package off its stale 5.6.3 pin. TypeScript 7 rejects an inferred rootDir (TS5011), so tsconfig.json sets it explicitly. Declaration output changes from one bundled index.d.ts to per-file .d.ts; astro check resolves them cleanly. apps/web stays on 6.0.3. @astrojs/check@0.9.10 (latest) declares a peer of typescript ^5.0.0 || ^6.0.0, so TS7 is excluded upstream. astro build works on 7 — only astro check breaks. Splitting the version within the package isn't worth it: tsconfig.worker.json covers 4 files while astro check covers 149. Revisit when Astro ships support. No changeset: typescript is a devDependency and does not affect the published CLI's runtime tree. Also splits packages/ui's tsconfig: tsconfig.json now covers src plus tsup.config.ts (for typecheck and type-aware lint), while a new tsconfig.build.json carries rootDir for the declaration emit. tsup.config.ts imports node:fs but sat outside every tsconfig include, so it had no program and type-aware lint on it failed — a latent issue predating this change, surfaced because the file is touched here. @types/node added to match the six other packages already on ^26.1.0.
|
CodeRabbit (@coderabbitai) review |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe repository upgrades TypeScript to 7.0.2. The UI package adds Node types and a dedicated declaration build. Its ChangesTypeScript and UI build updates
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-api | a9ab30c | Commit Preview URL Branch Preview URL |
Aug 05 2026, 01:27 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-auth | a9ab30c | Commit Preview URL Branch Preview URL |
Aug 05 2026, 01:27 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-web | a9ab30c | Commit Preview URL Branch Preview URL |
Aug 05 2026, 01:28 PM |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/tsconfig.json`:
- Line 18: Update the TypeScript compiler options in the packages/ui tsconfig
configuration to use lib: ["ES2022"] instead of the current ES2021, DOM, and
DOM.Iterable libraries, while preserving the existing include entries and other
settings.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b057762e-5dc9-4608-826b-be7d160a660f
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
apps/api/package.jsonapps/auth/package.jsonapps/mcp/package.jsonpackage.jsonpackages/billing/package.jsonpackages/comment-config/package.jsonpackages/email/package.jsonpackages/errors/package.jsonpackages/storage/package.jsonpackages/ui/package.jsonpackages/ui/tsconfig.build.jsonpackages/ui/tsconfig.jsonpackages/ui/tsup.config.tspackages/uploads/package.json
| "types": ["node"] | ||
| }, | ||
| "include": ["src"] | ||
| "include": ["src", "tsup.config.ts"] |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Use the required TypeScript library configuration.
Line 18 adds tsup.config.ts to a project that uses ES2021, DOM, and DOM.Iterable libraries. Update this project to use lib: ["ES2022"] without DOM libraries. The TypeScript rule requires this configuration for .ts files.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ui/tsconfig.json` at line 18, Update the TypeScript compiler options
in the packages/ui tsconfig configuration to use lib: ["ES2022"] instead of the
current ES2021, DOM, and DOM.Iterable libraries, while preserving the existing
include entries and other settings.
Source: Coding guidelines
|
Declining this one — I think the convention is being applied outside the scope it was written for. The
That reasoning is about Workers runtime code, where the Workers types own the globals and pulling in I did test the suggestion rather than dismiss it. It breaks the moment anyone writes ordinary UI-library code. Adding a single typical function to export function focusIt(el: HTMLDivElement | null) {
el?.focus();
}A DOM ref is routine in a component library, so this would be a latent trap rather than a hardening. Worth noting on scope too: this PR is a TypeScript version upgrade and didn't introduce the |
What
Moves 11 of 12 workspace packages to TypeScript 7.0.2, the native Go compiler.
apps/webis the sole holdout, for a reason upstream controls.Typecheck on
apps/apidrops from ~2.2s to ~1.1s. The wins are modest at this repo's size; the real value is being on the supported line before the ecosystem moves.The constraint that shapes this PR
TypeScript 7's npm package no longer ships the JS compiler API. Its main export is just
lib/version.cjs:ts.createProgram,ts.sys, and the language service now live behindtypescript/unstable/*. Any tool that doesimport ts from "typescript"and calls compiler APIs breaks at runtime. Usingtscas a CLI is fully supported — only the JS-API import path is affected.Two packages used such tools. Each was handled on its merits rather than pinned by default.
packages/ui— upgraded (build tool changed)Nothing about this package required an old TypeScript; only tsup's
dts: truedid, since it generates declarations throughrollup-plugin-dts.tscemits declarations directly, so tsup now builds only the JS bundle:This also lifts the package off a stale
5.6.3pin, two majors behind the rest of the repo.Declaration output changes from one bundled
index.d.tsto per-file.d.ts(12 files).astro checkresolves them cleanly — 150 files, 0 errors.apps/web— stays on^6.0.3@astrojs/check@0.9.10(latest) declares a peer oftypescript: "^5.0.0 || ^6.0.0". TS7 is excluded upstream, so this is not a version lag a bump can fix.Workarounds were tested, not assumed:
astro buildworks on TS7 (exit 0) — it runs through esbuild/vite and never touches the TS API. Onlyastro checkbreaks.@astrojs/checkwould still receive 7. It would require a realtypescript@6plus an alias whosetscbin collides in.bin, invoked by absolute path.The payoff wouldn't justify that complexity anyway.
tsconfig.worker.json— web's only directtscuse — covers 4 files;astro checkcovers 149. Upgrading would speed up 4 files and break type coverage on 149.Tracked in #610 — revisit when Astro ships TS7 support; it becomes a one-line change.
Behavior changes encountered
TypeScript 7 rejects an inferred
rootDir(TS5011), so the declaration emit needs it explicitly. This is the only TS7-specific code change in the PR.Incidental fix
packages/ui/tsup.config.tsimportsnode:fsbut sat outside every tsconfiginclude, so it had no program and type-aware lint on it failed. This predates this PR — the original file fails identically — and surfaced only because the file is touched here.Fixed by splitting the config:
tsconfig.jsonnow coverssrcplustsup.config.ts(typecheck + lint), and a newtsconfig.build.jsoncarriesrootDirfor the emit.@types/nodeadded at^26.1.0, matching the six other packages. Net effect:tsup.config.tsis now typechecked, where before it wasn't.Verification
pnpm typecheck(13 projects)astro checkpnpm testpnpm build(web)pnpm check(lint + format)@buildinternet/uploads).d.tsA sweep for other fallout found none: no first-party
typescriptimports anywhere, all tsconfigs already onmodule: ESNext+moduleResolution: bundlerwith none of the options TS7 removed, no version pinned in CI, and no docs stating a version.No changeset
typescriptis a devDependency and doesn't affect the published CLI's runtime tree.Summary by CodeRabbit
Chores
Developer Experience