Skip to content

chore: upgrade TypeScript from 5.9 to 6.0 - #2617

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
brandon/brandon-ts-upgrade
Jul 10, 2026
Merged

chore: upgrade TypeScript from 5.9 to 6.0#2617
kodiakhq[bot] merged 2 commits into
mainfrom
brandon/brandon-ts-upgrade

Conversation

@brandon-pereira

Copy link
Copy Markdown
Member

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, fix PR
    #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,
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)
  • 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.

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-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2bf0a8f

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

This PR includes changesets to release 6 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/cli Patch
@hyperdx/hdx-eval Patch
@hyperdx/otel-collector 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

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Jul 10, 2026 1:53pm
hyperdx-storybook Ready Ready Preview, Comment Jul 10, 2026 1:53pm

Request Review

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR upgrades the monorepo TypeScript toolchain to TypeScript 6. The main changes are:

  • TypeScript and ts-jest version bumps across the changed packages.
  • Deprecated compiler options removed or scoped where needed.
  • Path aliases rewritten after removing baseUrl.
  • Jest, ts-node, tsup, and CSS type shims adjusted for TypeScript 6.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/api/tsconfig.json Rewrites API path aliases and adds a ts-node-only rootDir override.
packages/app/tsconfig.json Updates app path aliases and adds a tests path mapping.
packages/common-utils/tsconfig.json Adds explicit test/runtime types, rootDir, and updated alias paths.
packages/hdx-eval/tsconfig.json Moves hdx-eval to node16 module settings and updates alias paths.
packages/app/css.d.ts Adds ambient declarations for plain stylesheet imports.
packages/common-utils/tsup.config.ts Scopes TypeScript deprecation handling to tsup declaration generation.
tsconfig.base.json Removes the shared downlevelIteration option.
yarn.lock Updates lockfile entries for the TypeScript and ts-jest upgrade.

Reviews (2): Last reviewed commit: "Merge branch 'main' into brandon/brandon..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 232 passed • 3 skipped • 1472s

Status Count
✅ Passed 232
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@brandon-pereira
brandon-pereira marked this pull request as ready for review July 9, 2026 21:33
@github-actions github-actions Bot added the review/tier-3 Standard — full human review required label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Cross-layer change: touches frontend (packages/app) + backend (packages/api) + shared utils (packages/common-utils)

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Production files changed: 15
  • Production lines changed: 82
  • Branch: brandon/brandon-ts-upgrade
  • Author: brandon-pereira

To override this classification, remove the review/tier-3 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a devDependency-only TypeScript 5.9 → 6.0 upgrade with tsconfig/build-tooling adjustments and no executable product-code changes. The baseUrl removals are compensated by rewritten relative paths (verified equivalent per package), and the new tests/* mapping in packages/app correctly replaces bare-specifier resolution that Playwright e2e specs previously got from baseUrl: ".". No data-loss, injection, auth, or happy-path crash risk is introduced.

🟡 P2 -- recommended

  • packages/api/package.json:79 -- The stated verification (tsc --noEmit, ts-node dev, jest, e2e) never exercises the emitting production build (tsc && tsc-alias), which is where tsc-alias rewrites @/* specifiers in output JS now that baseUrl is removed; if tsc-alias@1.8.8 resolves aliases differently without baseUrl, emitted files retain unresolved @/ imports and fail at runtime with module-not-found.
    • Fix: Run the emitting builds (yarn build for api and hdx-eval, yarn build for common-utils) and confirm output JS contains no unresolved @/ specifiers before merge.
    • ce-testing-reviewer, ce-correctness-reviewer
🔵 P3 nitpicks (2)
  • packages/app/css.d.ts:7 -- The ambient declare module '*.css' | '*.scss' | '*.sass' shims type these imports as any, which is broader than needed and would silently accept a mistyped stylesheet import path.

    • Fix: Keep the shims but consider constraining them to side-effect-only usage, or add a comment noting they intentionally forgo member typing.
  • packages/common-utils/eslint.config.mjs:16 -- Broadening the ignore list to **/*.config.ts removes tsup.config.ts (which this PR just modified) from lint coverage.

    • Fix: Confirm dropping *.config.ts files from lint is intended, or scope the ignore to specific config filenames.

Reviewers (5): ce-correctness-reviewer, ce-testing-reviewer, ce-maintainability-reviewer, ce-kieran-typescript-reviewer, ce-project-standards-reviewer.

Testing gaps: Emitting production builds (tsc-alias path rewrite, tsup DTS with ignoreDeprecations) are not covered by the cited lint/dev/test verification.

@kodiakhq
kodiakhq Bot merged commit bb7ae21 into main Jul 10, 2026
20 checks passed
@kodiakhq
kodiakhq Bot deleted the brandon/brandon-ts-upgrade branch July 10, 2026 13:58
kodiakhq Bot pushed a commit that referenced this pull request Jul 10, 2026
…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.
kodiakhq Bot pushed a commit that referenced this pull request Jul 13, 2026
…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.
jordan-simonovski pushed a commit that referenced this pull request Jul 13, 2026
## 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.
jordan-simonovski pushed a commit that referenced this pull request Jul 13, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants