chore: upgrade TypeScript from 5.9 to 6.0 - #2617
Conversation
Upgrade the TypeScript devDependency to ^6.0.3 across all packages and migrate configs off options TS 6 now flags as deprecation errors: - Drop no-op downlevelIteration (target is ES2022) and deprecated baseUrl, rewriting paths mappings to be relative to each tsconfig. - Switch hdx-eval off deprecated node10 resolution to node16. - Add explicit types/rootDir where TS 6 now requires them. - Declare ambient side-effect stylesheet modules for the app (TS2882). - Bump ts-jest to ^29.4.11 (supports TS 6, no longer forces node10); its transforms only need an explicit rootDir (TS5011). - Add a ts-node rootDir override for the api dev/e2e server (TS5011). - Ignore *.config.ts in common-utils eslint (parity with *.config.js). - tsup still hardcodes the deprecated baseUrl in its DTS build (egoist/tsup#1388), so its DTS transform sets ignoreDeprecations: '6.0'.
🦋 Changeset detectedLatest commit: 2bf0a8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR upgrades the monorepo TypeScript toolchain to TypeScript 6. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "Merge branch 'main' into brandon/brandon..." | Re-trigger Greptile |
E2E Test Results✅ All tests passed • 232 passed • 3 skipped • 1472s
Tests ran across 4 shards in parallel. |
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Deep Review✅ No critical issues found. This is a devDependency-only TypeScript 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (5): ce-correctness-reviewer, ce-testing-reviewer, ce-maintainability-reviewer, ce-kieran-typescript-reviewer, ce-project-standards-reviewer. Testing gaps: Emitting production builds ( |
…2621) ## Summary Fixes a build failure surfaced by the TypeScript 6 upgrade (#2617) when building the API Docker image: ``` tsconfig.json(8,5): error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. ``` ## Why it happens The API Docker build stage copies only `packages/api/src` into the builder image — it does **not** copy `migrations/` or `scripts/`. The default `build` script runs a bare `tsc`, which uses `tsconfig.json` with `include: ["src", "migrations", "scripts"]`. - Locally / in CI, all three directories exist, so `tsc` infers a common source dir that spans them and doesn't complain. - In the Docker image, only `src` is present, so the `include` glob resolves to `src/**` and the common source dir collapses to `./src`. TypeScript 6 now requires that inferred `rootDir` to be explicit, and fails with `TS5011`. `migrations/` ships to the runtime image as raw source (not compiled output) and `scripts/` is dev-only, so neither belongs in the compiled `build/` output — they only need to exist for lint/typecheck. ## Fix - Point the `build` script at `tsconfig.build.json`, which is now `src`-only with an explicit `rootDir: "./src"` (mirroring the existing `tsconfig.vercel.json`). This makes the build match what actually ships in the image. - `tsconfig.json` stays broad (`include: ["src", "migrations", "scripts"]`) so lint, `tsc --noEmit` typecheck, and `ts-node` continue to cover `migrations/` and `scripts/`. - Trimmed a now-inaccurate comment in `tsconfig.json`. ## Verification - Reproduced the exact `TS5011` locally by running the old build command against a `src`-only tree (matching the Docker builder), in the same `node:22-alpine` base image. - Confirmed the new `build` command succeeds in that same `src`-only environment, with `migrations/` correctly excluded from the compiled output. - `yarn build` (full tree) and `yarn ci:lint` pass; `make ci-lint` passes across all projects. Follow-up to #2617.
…2632) ## Why The nightly release ([run 29215841780](https://github.com/hyperdxio/hyperdx/actions/runs/29215841780)) has been failing across the **App**, **All-in-One**, and **Local** image builds with: ``` Type error: Cannot find module or type declarations for side-effect import of '@mantine/core/styles.css'. ``` The TypeScript 6 upgrade (#2617) introduced the stricter TS2882 check for side-effect imports of otherwise-untyped modules. To satisfy it, that PR added `packages/app/css.d.ts` with ambient `declare module '*.css'` (and `.scss`/`.sass`) declarations, which cover the stylesheet imports in `pages/_app.tsx`. This works locally, but **both Dockerfiles only copy `mdx.d.ts` into the build stage, not `css.d.ts`**. Inside the container the ambient declaration is missing, so `next build` fails type-checking. Local `tsc`/CI passed because `css.d.ts` is present on disk there — a source-level type check fundamentally cannot catch a file that exists in the repo but was never `COPY`ed into the image. ## What **The fix** - Add `css.d.ts` to the `COPY` line in `docker/hyperdx/Dockerfile` (App / All-in-One / Local nightly + release images) and `packages/app/Dockerfile` (standalone app image), right alongside the existing `mdx.d.ts`. - Drop a stray `export` on `getAlertWindowStart` (`packages/api/src/tasks/checkAlerts/index.ts`) — only used within its own file. Pre-existing dead export flagged by the pre-commit `knip` check, which was blocking commits through the hook. - Patch changeset for `@hyperdx/app`. **Prevention** — new `Docker Build` workflow (`.github/workflows/docker-build.yml`) - Builds each released image on PRs with `push: false`, so image-only build failures are caught in review instead of the nightly. - **Conditional on changed paths** (via `tj-actions/changed-files`, matching the existing otel-collector gating in `main.yml`) so unrelated PRs skip the builds: - OTel Collector image → `docker/otel-collector/**`, `packages/otel-collector/**` - App/prod image → `packages/{api,app,common-utils}/**`, `docker/hyperdx/**`, root deps - All-in-one image → the above plus `docker/clickhouse/**`, `docker/otel-collector/**` - Single-arch (amd64), warmed from the nightly gha cache scopes, to keep PR runtimes low. Build errors here are arch-independent. ## Verification Ran the `docker/hyperdx` `builder` target locally (the stage that runs `next build`) with the fix: ``` #34 [builder 10/11] RUN yarn workspace @hyperdx/api run build && yarn workspace @hyperdx/app run build #34 Running TypeScript ... #34 ✓ Compiled successfully in 25.7s ... #36 DONE (exit 0) ``` The TS2882 error is gone and the image builds cleanly.
## Why Move the monorepo onto TypeScript 6 (latest stable, `6.0.3`) from `5.9`. TS 6 is the transition release before TS 7 — it converts several soon-to-be-removed compiler options into **deprecation errors**, so upgrading now surfaces and lets us fix those ahead of the (breaking) TS 7 release. Staying on v6 for now, not v7. TypeScript is a `devDependency` in every package (build-time only, not shipped), so there is no runtime behavior change for users. ## What changed **Dependency** - `typescript` → `^6.0.3` in all 5 packages. - `ts-jest` → `^29.4.11` (its peer range now allows TS 6, and it no longer forces `node10` module resolution). **TS 6 deprecations fixed at the source (not just silenced)** - Removed no-op `downlevelIteration` from `tsconfig.base.json` (target is ES2022). - Removed deprecated `baseUrl`; rewrote `paths` mappings to be relative to each tsconfig (api, app, common-utils, hdx-eval). - Switched `hdx-eval` off deprecated `node10` resolution → `node16`. **New TS 6 requirements** - Added explicit `types: ["jest","node"]` + `rootDir` to `common-utils` (TS 6 changed auto-`@types` inclusion; hoisted root `@types` no longer auto-resolve). - Added `tests/*` path mapping and a `css.d.ts` ambient shim for plain `.css`/`.scss` side-effect imports — Next 16 only ships `*.module.css` types and TS 6 now enforces `TS2882` for untyped side-effect imports. **Tooling workarounds (scoped, documented)** - `ts-jest` transforms (api, app): explicit `rootDir` — TS 6 requires it when compiling a file subset per-file (`TS5011`). - api dev/e2e server runs via `ts-node`, which also hit `TS5011`; added a `ts-node.compilerOptions.rootDir` override (scoped to ts-node; the full `tsc` build keeps its multi-dir root). - `tsup` still hardcodes the now-deprecated `baseUrl` in its DTS build ([egoist/tsup#1388](egoist/tsup#1388), fix PR [#1390](egoist/tsup#1390) still open), so its DTS transform sets `ignoreDeprecations: "6.0"`. - `common-utils` eslint now ignores `*.config.ts` (parity with the existing `*.config.js`/`.mjs` ignores). Relevant upstream: TS 6 deprecation list [microsoft/TypeScript#54500](microsoft/TypeScript#54500), ts-jest TS 6 support [kulshekhar/ts-jest#4198](kulshekhar/ts-jest#4198) (shipped in 29.4.11). ## Verification - `make ci-lint` — ✅ 5 projects (lint + `tsc --noEmit`, 0 errors) - `make ci-unit` — ✅ common-utils (1406), cli (8), app (2272), hdx-eval (211) - Integration — ✅ api (`make dev-int`, 1716), common-utils (51) - E2E (`make e2e`) — ✅ 223 passed; the ts-node `TS5011` was caught and fixed here. Remaining failures were all pre-existing flaky timeouts (unrelated to TS) that pass in isolation. - Dev-mode dry run (`yarn dev`) — ✅ api (ts-node) `/health` 200, app (Next 16) ready, no TS errors. ## Notes - Branch prefix is `brandon/` rather than `claude/`/`agent/` because the worktree/branch was set up ahead of time; happy to rename if triage prefers.
…2621) ## Summary Fixes a build failure surfaced by the TypeScript 6 upgrade (#2617) when building the API Docker image: ``` tsconfig.json(8,5): error TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. ``` ## Why it happens The API Docker build stage copies only `packages/api/src` into the builder image — it does **not** copy `migrations/` or `scripts/`. The default `build` script runs a bare `tsc`, which uses `tsconfig.json` with `include: ["src", "migrations", "scripts"]`. - Locally / in CI, all three directories exist, so `tsc` infers a common source dir that spans them and doesn't complain. - In the Docker image, only `src` is present, so the `include` glob resolves to `src/**` and the common source dir collapses to `./src`. TypeScript 6 now requires that inferred `rootDir` to be explicit, and fails with `TS5011`. `migrations/` ships to the runtime image as raw source (not compiled output) and `scripts/` is dev-only, so neither belongs in the compiled `build/` output — they only need to exist for lint/typecheck. ## Fix - Point the `build` script at `tsconfig.build.json`, which is now `src`-only with an explicit `rootDir: "./src"` (mirroring the existing `tsconfig.vercel.json`). This makes the build match what actually ships in the image. - `tsconfig.json` stays broad (`include: ["src", "migrations", "scripts"]`) so lint, `tsc --noEmit` typecheck, and `ts-node` continue to cover `migrations/` and `scripts/`. - Trimmed a now-inaccurate comment in `tsconfig.json`. ## Verification - Reproduced the exact `TS5011` locally by running the old build command against a `src`-only tree (matching the Docker builder), in the same `node:22-alpine` base image. - Confirmed the new `build` command succeeds in that same `src`-only environment, with `migrations/` correctly excluded from the compiled output. - `yarn build` (full tree) and `yarn ci:lint` pass; `make ci-lint` passes across all projects. Follow-up to #2617.
Why
Move the monorepo onto TypeScript 6 (latest stable,
6.0.3) from5.9. TS 6 isthe transition release before TS 7 — it converts several soon-to-be-removed
compiler options into deprecation errors, so upgrading now surfaces and
lets us fix those ahead of the (breaking) TS 7 release. Staying on v6 for now,
not v7.
TypeScript is a
devDependencyin every package (build-time only, not shipped),so there is no runtime behavior change for users.
What changed
Dependency
typescript→^6.0.3in all 5 packages.ts-jest→^29.4.11(its peer range now allows TS 6, and it no longerforces
node10module resolution).TS 6 deprecations fixed at the source (not just silenced)
downlevelIterationfromtsconfig.base.json(target is ES2022).baseUrl; rewrotepathsmappings to be relative to eachtsconfig (api, app, common-utils, hdx-eval).
hdx-evaloff deprecatednode10resolution →node16.New TS 6 requirements
types: ["jest","node"]+rootDirtocommon-utils(TS 6 changed auto-
@typesinclusion; hoisted root@typesno longerauto-resolve).
tests/*path mapping and acss.d.tsambient shim for plain.css/.scssside-effect imports — Next 16 only ships*.module.csstypesand TS 6 now enforces
TS2882for untyped side-effect imports.Tooling workarounds (scoped, documented)
ts-jesttransforms (api, app): explicitrootDir— TS 6 requires it whencompiling a file subset per-file (
TS5011).ts-node, which also hitTS5011; added ats-node.compilerOptions.rootDiroverride (scoped to ts-node; the fulltscbuild keeps its multi-dir root).
tsupstill hardcodes the now-deprecatedbaseUrlin its DTS build(egoist/tsup#1388, fix PR
#1390 still open), so its DTS
transform sets
ignoreDeprecations: "6.0".common-utilseslint now ignores*.config.ts(parity with the existing*.config.js/.mjsignores).Relevant upstream: TS 6 deprecation list
microsoft/TypeScript#54500,
ts-jest TS 6 support
kulshekhar/ts-jest#4198
(shipped in 29.4.11).
Verification
make ci-lint— ✅ 5 projects (lint +tsc --noEmit, 0 errors)make ci-unit— ✅ common-utils (1406), cli (8), app (2272), hdx-eval (211)make dev-int, 1716), common-utils (51)make e2e) — ✅ 223 passed; the ts-nodeTS5011was caught and fixedhere. Remaining failures were all pre-existing flaky timeouts (unrelated to
TS) that pass in isolation.
yarn dev) — ✅ api (ts-node)/health200, app (Next 16)ready, no TS errors.
Notes
brandon/rather thanclaude//agent/because theworktree/branch was set up ahead of time; happy to rename if triage prefers.