Skip to content

Unify TypeScript 6 across workspaces and fix TS 6 typings defaults. - #127

Merged
droid-ash merged 2 commits into
mainfrom
ts-version-update
Apr 28, 2026
Merged

droid-ash merged 2 commits into
mainfrom
ts-version-update

Conversation

@arnoldlaishram

@arnoldlaishram arnoldlaishram commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Pin typescript to ^6.0.3 in every workspace package so npm hoists one major version for builds and tooling. Extend tsconfig.base.json with typeRoots targeting the repo @types folder and types: [*] so TypeScript 6 still loads ambient typings (Node globals, tests) after its types default stopped auto-including packages under node_modules/@types.

What was broken

Building from a clean checkout (no node_modules) didn't work. Three separate issues:

  1. Node's built-in types weren't found. After the TS 6 bump, TypeScript was told to look for type definitions inside each package's own folder. In a monorepo those folders are usually empty — the types live at the repo root. Most packages couldn't find types for node:fs, node:path, etc.
    Fix: also point TypeScript at the repo-root types folder, and add modern Node type definitions at the root so they exist.

  2. Vite 8 has a fragile install. Vite 8 needs rolldown and lightningcss. It declares them as dependencies, but our monorepo setup silently drops them, so Vite crashed mid-build.
    Fix: declare both directly in report-web so they always get installed.

  3. The pre-build sanity check was lying. A guard script checked "is everything installed?" by looking in the wrong place. Even on a working install it would abort with "missing packages, run npm ci".
    Fix: simplified to just check that install was run at all.

Worth flagging

package-lock.json is gitignored, so every fresh install picks slightly different versions. That's why these issues showed up "randomly" and why a build can be green on one laptop and red on another. Worth a separate discussion on committing it.

Validation

  • npm run build (from a clean rm -rf node_modules && npm i)
  • npm test
  • npm run lint

Summary by CodeRabbit

  • Chores
    • Updated TypeScript compiler to version 6.0.3 across all development packages, bringing enhanced language features, improved type checking, and better build consistency across tools.
    • Refined TypeScript configuration with explicit type declaration resolution settings to ensure more reliable and predictable type definition handling throughout the development and build process.

Pin typescript to ^6.0.3 in every workspace package so npm hoists one
major version for builds and tooling. Extend tsconfig.base.json with
typeRoots targeting the repo @types folder and types: [`*`] so
TypeScript 6 still loads ambient typings (Node globals, tests) after its
types default stopped auto-including packages under node_modules/@types.

Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR updates TypeScript from version 5.x to 6.0.3 across six package workspaces and explicitly configures type resolution in the base tsconfig with typeRoots and types settings.

Changes

Cohort / File(s) Summary
TypeScript Version Bump
packages/cli/package.json, packages/cloud-core/package.json, packages/common/package.json, packages/device-node/package.json, packages/goal-executor/package.json
Updated TypeScript devDependency from ^5.7.0 to ^6.0.3 across five packages.
TypeScript Version Bump (Report Web)
packages/report-web/package.json
Updated TypeScript devDependency from ^5.9.0 to ^6.0.3.
TypeScript Configuration
tsconfig.base.json
Added explicit typeRoots setting pointing to ./node_modules/@types and explicit types: ["*"] to define type resolution behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • srinidhi-lwt

Poem

🐰 Hop along, dear TypeScript friends!
From five to six, the upgrade descends,
Types now rooted, with explicit care,
Six-point-oh-three floats through the air! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Unify TypeScript 6 across workspaces and fix TS 6 typings defaults' clearly and specifically describes the main changes: upgrading TypeScript to version 6 across multiple packages and adjusting tsconfig to handle TypeScript 6's typing behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ts-version-update

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 and usage tips.

@arnoldlaishram arnoldlaishram self-assigned this Apr 28, 2026
@arnoldlaishram arnoldlaishram added the enhancement New feature or request label Apr 28, 2026
Make `npm i && npm run build` work from a fully clean state. Three
issues surfaced after the TS 6 unification commit and Vite 8 bump:

- tsconfig.base.json typeRoots was workspace-relative only, so only
  workspaces that nested their own @types/ (report-web) found Node
  types; the rest hit TS2591 on `node:*` imports. Add the repo-root
  path so hoisted @types are visible from every workspace.
- Add @types/node at the root so a modern version hoists, instead of
  relying on an ancient transitive @types/node@12 that predates the
  `node:` module-name protocol.
- Vite 8 lists rolldown and lightningcss as regular deps, but npm
  workspace hoisting drops them. Declare both explicitly in
  report-web (rolldown was already there; lightningcss was missing).

Also replace the brittle hoisted-package check in
scripts/ensure-dev-install.mjs with a simple root node_modules check
so it stops false-firing on packages npm chose to nest.
@droid-ash droid-ash added bug Something isn't working and removed enhancement New feature or request labels Apr 28, 2026
@droid-ash
droid-ash merged commit f248431 into main Apr 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants