Skip to content

fix(tsconfig): silence TS 7.0 baseUrl + rootDir deprecation warnings#472

Open
roiizchak wants to merge 1 commit intoheygen-com:mainfrom
roiizchak:fix/tsconfig-ts7-deprecations
Open

fix(tsconfig): silence TS 7.0 baseUrl + rootDir deprecation warnings#472
roiizchak wants to merge 1 commit intoheygen-com:mainfrom
roiizchak:fix/tsconfig-ts7-deprecations

Conversation

@roiizchak
Copy link
Copy Markdown
Contributor

@roiizchak roiizchak commented Apr 24, 2026

Summary

TypeScript 7.0 deprecates the baseUrl compiler option unless ignoreDeprecations is set, and also flags tsconfigs whose computed common source directory differs from an explicit rootDir. Both conditions currently trigger warnings in packages/cli/tsconfig.json and packages/studio/tsconfig.json:

  • packages/cli/tsconfig.jsonbaseUrl deprecation and "common source directory is '..'" because paths maps @hyperframes/producer to ../producer/src/index.ts, pulling the compiler's root above ./src.
  • packages/studio/tsconfig.jsonbaseUrl deprecation only (rootDir is already "..").

The other six package tsconfigs (core, engine, player, player/tests/perf, producer, shader-transitions) set rootDir explicitly and don't use baseUrl, so they don't trip either warning.

Changes

packages/cli/tsconfig.json — add ignoreDeprecations: "5.0" and rootDir: ".." (matches studio's pattern; covers both cli/src and the resolved paths target under packages/):

     "moduleResolution": "bundler",
+    "ignoreDeprecations": "5.0",
     "baseUrl": ".",
     "paths": {
       "@hyperframes/producer": ["../producer/src/index.ts"]
     },
     ...
     "outDir": "./dist",
-    "declaration": true
+    "declaration": true,
+    "rootDir": ".."
   },

packages/studio/tsconfig.json — add ignoreDeprecations: "5.0" only:

     "moduleResolution": "bundler",
+    "ignoreDeprecations": "5.0",
     "baseUrl": ".",
     "paths": {
       "@hyperframes/player": ["../player/src/hyperframes-player.ts"]
     },

Rationale

  • ignoreDeprecations: "5.0" is the only value TypeScript 5.x accepts — TS 5.9.3's getIgnoreDeprecationsVersion() explicitly rejects every other value (including "6.0") with Invalid value for '--ignoreDeprecations'. Newer editor LS versions suggest "6.0" in their warning text, but that fails typecheck on this repo's pinned compiler. It leaves baseUrl/paths behavior unchanged while silencing the warning until a future refactor is ready to drop paths in favor of bun workspace resolution.
  • Setting rootDir: ".." on the CLI matches the existing pattern in packages/studio/tsconfig.json, and keeps the resolved @hyperframes/producer file under rootDir so no TS6059 is introduced.

Test plan

  • bun install — clean.
  • bun run build — builds successfully with no new errors.
  • bunx oxlint packages/cli/tsconfig.json packages/studio/tsconfig.json — clean.
  • bunx oxfmt --check packages/cli/tsconfig.json packages/studio/tsconfig.json — clean.
  • Editor verification: both deprecation warnings disappear in VS Code / Cursor / any editor running TS ≥ 5.5 LS.

No runtime changes. No emit-layout changes — the CLI builds via tsup (packages/cli/package.json "build": "bun run build:fonts && tsup && ...") and studio via vite build; the typecheck script is tsc --noEmit. An explicit rootDir would shift emit paths if tsc were doing the emit (it overrides the auto-computed common source directory), but here it only feeds the typechecker, which doesn't write files. Packages that emit via tsc -b (e.g. core, engine) are untouched by this PR.

@roiizchak roiizchak force-pushed the fix/tsconfig-ts7-deprecations branch from 57f10a4 to 32995b5 Compare April 24, 2026 09:52
Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Approve. The change is functionally correct — both bun run --filter '@hyperframes/{cli,studio}' typecheck exit clean — and the ignoreDeprecations: "5.0" value is the canonical silencer for baseUrl on the repo's TypeScript 5.9.3.

That said, the PR description does not match the code, and the reasoning given for one of the changes is wrong. Both are worth fixing before merge so the description doesn't mislead future readers.

Key Concerns

(none blocking — see below)

Test Coverage

No test changes needed; this is a tsconfig metadata change with no runtime/emit effect (verified separately — see "Nits" item 2). The "verified clean" line in the test plan is what matters here, and typecheck confirms it.

Nits / Future

  1. Description ↔ code mismatch on ignoreDeprecations value. The PR body's diff snippets show "ignoreDeprecations": "6.0", but both packages/cli/tsconfig.json:6 and packages/studio/tsconfig.json:6 use "5.0". The code is right — node_modules/typescript/lib/typescript.js (TS 5.9.3) explicitly rejects every value other than "5.0":

    // typescript.js: getIgnoreDeprecationsVersion()
    if (ignoreDeprecations === "5.0") {
      return new Version(ignoreDeprecations);
    }
    reportInvalidIgnoreDeprecations();   // any other value, including "6.0", errors out

    So anyone copy-pasting "6.0" from the description would actually break their build. Recommend updating the PR body before merge so it doesn't become misleading historical documentation.

  2. rootDir: ".." reasoning in the description is incorrect, but the change is still safe — for a different reason. The description claims rootDir: ".." "only affects how TS computes error paths and does not alter emitted file locations when combined with include: [\"src\"]." That isn't how TypeScript works — an explicit rootDir overrides the auto-computed common source directory and would shift emit paths from dist/foo.ts to dist/cli/src/foo.ts if tsc were doing the emit.

    The change is still safe because the CLI doesn't use tsc to emit (packages/cli/package.json:18"build": "bun run build:fonts && tsup && ..."), and typecheck is tsc --noEmit. Same for studio (vite build). So rootDir here only feeds the typechecker, and the typechecker doesn't write files. Worth correcting the description so future readers don't generalize the (wrong) reasoning to packages that do use tsc -b for emit (e.g. core, engine).

  3. (Future) Once paths is dropped in favor of bun workspace resolution (as the description hints), the whole baseUrl+paths+ignoreDeprecations block on both packages can come out together. Tracking-only — out of scope here.

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.

3 participants