From ad00e1f8d6d11f74e072055a247684c99e0a3752 Mon Sep 17 00:00:00 2001 From: Brandon Pereira Date: Fri, 10 Jul 2026 11:35:02 -0600 Subject: [PATCH] fix(api): resolve TS5011 in Docker build after TypeScript 6 upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The api Docker build stage copies only packages/api/src into the builder image (not migrations/ or scripts/), so the default `tsc` build using tsconfig.json's include: [src, migrations, scripts] collapses the common source dir to ./src. TypeScript 6 then requires an explicit rootDir and fails with TS5011. Point the build script at tsconfig.build.json — now src-only with an explicit rootDir, mirroring tsconfig.vercel.json — so the build matches what actually ships in the image. tsconfig.json stays broad so lint, typecheck, and ts-node continue to cover migrations/ and scripts/. Follow-up to #2617. --- packages/api/package.json | 2 +- packages/api/tsconfig.build.json | 16 ++++++---------- packages/api/tsconfig.json | 3 +-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index da78b80ec5..54d8bacfa6 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -87,7 +87,7 @@ "dev": "DOTENV_CONFIG_PATH=.env.development nodemon --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/index.ts", "dev:mcp": "npx @modelcontextprotocol/inspector", "dev-task": "DOTENV_CONFIG_PATH=.env.development nodemon --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/tasks/index.ts", - "build": "rimraf ./build && tsc && tsc-alias && cp -r ./src/opamp/proto ./build/opamp/", + "build": "rimraf ./build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && cp -r ./src/opamp/proto ./build/opamp/", "build:vercel": "rimraf ./build && tsc -p tsconfig.vercel.json && tsc-alias -p tsconfig.vercel.json && cp -r ./src/opamp/proto ./build/opamp/", "lint": "npx eslint --quiet . --ext .ts", "lint:fix": "npx eslint . --ext .ts --fix", diff --git a/packages/api/tsconfig.build.json b/packages/api/tsconfig.build.json index af9b44c61f..a6e0966cf1 100644 --- a/packages/api/tsconfig.build.json +++ b/packages/api/tsconfig.build.json @@ -1,12 +1,8 @@ { "extends": "./tsconfig.json", - "include": [ - "src", - "migrations", - "scripts" - ], - "exclude": [ - "node_modules", - "**/*.test.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "rootDir": "./src" + }, + "include": ["src"], + "exclude": ["node_modules", "**/*.test.ts"] +} diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index da045488fe..09b1834aff 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -16,8 +16,7 @@ "compilerOptions": { // ts-node compiles single files on demand (e.g. `src/index.ts` for the // dev server), so TypeScript infers the common source dir as `./src`. - // TS 6 requires that inferred rootDir to be explicit (TS5011). The full - // `tsc` build keeps its implicit root (which spans src/migrations/scripts). + // TS 6 requires that inferred rootDir to be explicit (TS5011). "rootDir": "./src" } },