Skip to content

chore: migrate workspace to TypeScript 7 (native compiler) - #41932

Draft
KevLehman wants to merge 5 commits into
developfrom
claude/typescript-v7-migration-tw4tqh
Draft

chore: migrate workspace to TypeScript 7 (native compiler)#41932
KevLehman wants to merge 5 commits into
developfrom
claude/typescript-v7-migration-tw4tqh

Conversation

@KevLehman

@KevLehman KevLehman commented Aug 25, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Migrates the workspace default compiler to typescript@~7.0.2 (the native Go compiler) and adapts everything TS7 no longer accepts. Builds on the chore/ts7-spike work — the typia/ttsc and ajv-normalization changes are ported from that branch onto current develop.

Shared config (@rocket.chat/tsconfig)

  • target es5es2022 (ES3/ES5 removed) and moduleResolution nodebundler (node10 removed). TS7 accepts bundler with module: commonjs, which TS5.9 didn't — the reason the spike had to keep the base config frozen and inject CLI overrides instead.
  • types: ["node", "jest"] — TS7 no longer auto-includes ambient @types/* (livechat additionally names webpack-env for module.hot / require.context).

Per-package config fixes

  • Explicit rootDir wherever outDir is set (new TS5011 requirement). The cross-importing services (authorization-service, ddp-streamer) root at the repo root, preserving the monorepo-mirrored dist layout the ee/apps/Dockerfile overlay expects.
  • baseUrl removed everywhere (TS5102); paths values made relative (TS5090); mappings added for tinykeys (no types condition in its exports map) and swiper/swiper-react.
  • apps-engine and memo dual builds moved off the removed moduleResolution: node; TS5.9-pinned packages inheriting the base (livechat, emitter) set module: "preserve", which both compilers accept with bundler resolution.

typia toolchain (ported from the spike, adapted)

  • core-typings and ui-kit emit via ttsc driving the tsgo binary; typia 9.7.2 (patched) → 13.0.2 repo-wide (apps/meteor aligned, patch dropped); schema emit normalized for ajv/dist/2020 strict; OpenAPI doc reports 3.1.0.
  • TS7 canary workflow + scripts/ts7-typecheck.sh, simplified: the shared config now carries the TS7 options, so the canary runs with no overrides.

Pinned to typescript@~5.9.3 (their toolchain still links the JS compiler API, which typescript@7 no longer ships): core-typings, ui-kit (typia TS5 path), eslint-config (typescript-eslint peer <6.1.0, with installConfig.hoistingLimits so the lint toolchain nests beside its TS), message-parser, livechat (ts-node-loaded webpack configs), emitter, mp3-encoder (@rollup/plugin-typescript). Vestigial ts-jest devDeps dropped (suites run on @swc/jest); jest 30 loads jest.config.ts without ts-node on Node 22.

Code fixes for TS7's sharper checking

  • release-action: cast at the GitHub.plugin(throttling) boundary — the two bundled @octokit/core type trees no longer unify.
  • MessageListProvider: annotate callbacks in conditional branches that no longer receive contextual types.
  • saveCannedResponse: normalize optional tags to [] where the model type requires an array.

Validation: all workspace package and ee service app builds green locally (the only local failures are deno-cache steps — deno isn't installed in the dev container); typia transform verified at runtime (199 component schemas); jest suites and eslint spot-checked green. TS7 canary: 72/73 tsconfigs green; apps/meteor remains red on a single root cause (legacy ChatEndpoints vs. the migrated chat route augmentation, TS2320 ×140), tracked with the other follow-ups in docs/typescript-7-migration.md. A changeset is included for the typia bump.

Issue(s)

N/A — infrastructure migration; remaining work is tracked in docs/typescript-7-migration.md.

Steps to test or reproduce

  • yarn install
  • yarn turbo run build --filter='./packages/*' --filter='./ee/packages/*' --filter='./ee/apps/*'
  • bash scripts/ts7-typecheck.sh — prints the per-package TS7 canary tally (expected: 72/73 green, apps/meteor red on the chat-endpoints TS2320 only)
  • Spot-check tests/lint: yarn workspace @rocket.chat/ui-kit test, yarn workspace @rocket.chat/tools lint

Further comments

Draft on purpose: the goal is to switch emit/typecheck to the native compiler now while tools that still require the JS compiler API stay pinned to 5.9.3, each with a documented unpin condition (typescript-eslint, typedoc, rollup-plugin-typescript, ts-node). The apps/meteor TS2320 burn-down belongs to the chat portion of the API endpoint migration (each /v1/chat.* route should end up declared exactly once), which is deliberately out of scope here. See docs/typescript-7-migration.md for the full status, pin rationale, and follow-ups.

🤖 Generated with Claude Code

https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ


Generated by Claude Code

Review in cubic

Bump `typescript` to ~7.0.2 (the native compiler) across the monorepo and
migrate everything TS7 no longer accepts. Builds on the chore/ts7-spike
work: the typia/ttsc and ajv-normalization changes are ported from that
branch onto current develop.

Shared config (@rocket.chat/tsconfig):
- target es5 -> es2022 (ES3/ES5 removed), moduleResolution node -> bundler
  (node10 removed; TS7 allows bundler with module commonjs, which TS5.9
  didn't — the reason the spike had to keep the base config frozen)
- types: [node, jest] — TS7 no longer auto-includes ambient @types
  (livechat additionally names webpack-env for module.hot/require.context)

Per-package config fixes:
- explicit rootDir wherever outDir is set (new TS5011 requirement); the
  cross-importing services (authorization-service, ddp-streamer) root at the
  repo root to keep the monorepo-mirrored dist layout the ee/apps Dockerfile
  overlays
- baseUrl removed everywhere (TS5102): paths resolve relative to the
  tsconfig now, and meteor's "/*" mapping becomes "./*" (TS5090); paths
  entries added for tinykeys (no types condition in its exports map) and
  swiper/swiper-react
- apps-engine and memo dual builds off the removed moduleResolution node;
  TS5.9-pinned packages that inherit the base (livechat, emitter) set
  module preserve, which both compilers accept with bundler resolution

typia toolchain (ported from the spike, adapted):
- core-typings and ui-kit emit via ttsc driving the tsgo binary; typia
  9.7.2 (patched) -> 13.0.2 repo-wide (apps/meteor aligned, patch dropped);
  schema emit normalized for ajv/dist/2020 strict; OpenAPI doc at 3.1.0
- TS7 canary workflow + scripts/ts7-typecheck.sh, simplified: the shared
  config now carries the TS7 options, so the canary runs with no overrides

Pinned to typescript ~5.9.3 (toolchain still needs the JS compiler API,
which typescript@7 no longer ships): core-typings, ui-kit (typia TS5 path),
eslint-config (typescript-eslint peer <6.1, with hoistingLimits so the lint
toolchain nests beside its TS), message-parser, livechat (ts-node-loaded
webpack configs), emitter, mp3-encoder (@rollup/plugin-typescript).
Vestigial ts-jest devDeps dropped (suites run on @swc/jest); jest 30 loads
jest.config.ts without ts-node on Node 22.

Code fixes for TS7's sharper checking:
- release-action: cast at the GitHub.plugin(throttling) boundary — the two
  bundled @octokit/core type trees no longer unify
- MessageListProvider: annotate callbacks in conditional branches that no
  longer receive contextual types
- saveCannedResponse: normalize optional tags to [] where the model type
  requires an array

Validated locally: all workspace package + ee app builds green (the only
failures in this environment are deno-cache steps — deno is not installed
here); typia transform verified at runtime (199 component schemas); jest
suites and eslint spot-checked green. TS7 canary: 72/73 tsconfigs green;
apps/meteor remains red on a single root cause (legacy ChatEndpoints vs
migrated chat route augmentation, TS2320 x140) tracked in
docs/typescript-7-migration.md.

Co-authored-by: Guilherme Gazzo <guilherme@gazzo.xyz>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ
@dionisio-bot

dionisio-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 033bea5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@rocket.chat/core-typings Patch
@rocket.chat/ui-kit Patch
@rocket.chat/meteor Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

claude added 3 commits August 25, 2026 05:46
- root: declare `globals` as a devDependency — the root eslint.config.mjs
  imports it directly and previously resolved it by hoisting accident; the
  eslint-config hoistingLimits change let a transitive globals@11 win the
  root spot, crashing every lint run using the root config (livechat,
  meteor) with the trailing-whitespace AudioWorkletGlobalScope bug
- apps/meteor: jest.config.ts -> jest.config.mjs. The package declares
  "type": "commonjs", which disables Node's ESM syntax-detection fallback
  for .ts configs, and jest 30's .mts loader drops the `projects` array
  (suites then ran with default testMatch, no jsdom, no mappers). Plain
  ESM .mjs loads correctly: 305/305 jest suites + both mocha passes green
- server-fetch: jest 29 -> ~30.2.0; jest 29 requires ts-node for TS
  configs, which crashes against the TS7 API
- packages/apps: pin typescript ~5.9.3 (node --test suites load TS via
  ts-node; extensionless CJS-style relative imports rule out native type
  stripping) and pass TS_NODE_COMPILER_OPTIONS so ts-node (TS5.9) doesn't
  see the base config's bundler resolution

abac unit-test failures reproduce locally only because mongodb-memory-server
cannot download its binary through the sandbox proxy; CI restores it from
cache. The remaining red CI check is the documented apps/meteor typecheck
burn-down (TS2320 x140, single root cause).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ
Pinning packages/apps to TS5.9 left its build:default on the shared base's
commonjs + bundler pair, which TS5.9 rejects (TS5095). node16/node16 is
accepted by both compilers and emits the same CommonJS dist; the TS7 canary
stays green on this package.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ
The spec drives two full reconnect cycles through real-time mock-socket
handshakes (only the retry windows use fake timers); on a loaded CI runner
that can exceed jest's default 5s, which is how it flaked on this PR's
unit-test job. Passes consistently locally — give it explicit headroom.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.30%. Comparing base (02982b0) to head (033bea5).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #41932   +/-   ##
========================================
  Coverage    69.30%   69.30%           
========================================
  Files         4255     4255           
  Lines       168645   168696   +51     
  Branches     30083    30115   +32     
========================================
+ Hits        116877   116923   +46     
+ Misses       46589    46584    -5     
- Partials      5179     5189   +10     
Flag Coverage Δ
unit 71.23% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The explicit parameter annotations added for TS7 pushed two lines past the
print width; prettier (via eslint) flags them as errors in Code Lint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014kBpQd6yQsB9qif313UvSQ
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.

2 participants