Skip to content

chore(tsconfig): explicit rootDir for TypeScript 6.0 compatibility#48

Merged
sjsyrek merged 1 commit intomainfrom
fix/tsconfig-rootdir-for-ts60
Apr 27, 2026
Merged

chore(tsconfig): explicit rootDir for TypeScript 6.0 compatibility#48
sjsyrek merged 1 commit intomainfrom
fix/tsconfig-rootdir-for-ts60

Conversation

@sjsyrek
Copy link
Copy Markdown
Contributor

@sjsyrek sjsyrek commented Apr 27, 2026

Summary

One-line tsconfig change: add `"rootDir": "./src"` to compilerOptions. Required for TypeScript 6.0 (which made the previously-inferred rootDir explicit), forward- and backward-compatible with TypeScript 5.x.

Why

Dependabot PR #34 (typescript 5.9.3 → 6.0.2) currently fails build on Node 22 with:

```
tsconfig.json(13,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.
Visit https://aka.ms/ts6 for migration information.
```

This change makes the inferred value explicit. After merge, dependabot rebases #34 and it should pass.

Backward Compatibility

Unchanged on TS 5.9.x. `rootDir` has been a supported option for years; making it explicit just locks in what TS 5.x was already inferring.

Verification

Verified locally on the current pinned TypeScript (5.9.x):

  • `npm run build` — clean
  • `npm run type-check` — clean
  • `npm run lint` — clean
  • `npm test` — 5490 / 5490 tests pass across 231 suites

Size: Small ✓

One-line config change.

🤖 Generated with Claude Code

…patibility

TypeScript 6.0 made `rootDir` a required option when the source layout
has files outside `outDir`'s implied root (which is our case — we have
tests/ alongside src/, and `outDir` is ./dist). On TS 5.x the inference
worked silently; on TS 6.0 it errors:

  tsconfig.json(13,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.

Adding `"rootDir": "./src"` is forward- and backward-compatible: it
matches what TS 5.x was inferring, so build, type-check, lint, and test
behavior on the current pinned TypeScript (5.9.x) is unchanged. Verified
locally: \`npm run build\`, \`npm run type-check\`, \`npm run lint\`, and
\`npm test\` (5490 tests) all green at this commit.

Unblocks #34 (typescript 5.9.3 → 6.0.2 dependabot bump): once this PR
lands and dependabot rebases #34, its build step will succeed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sjsyrek sjsyrek assigned sjsyrek and DeeJayTC and unassigned sjsyrek and DeeJayTC Apr 27, 2026
@sjsyrek sjsyrek merged commit 3094032 into main Apr 27, 2026
3 checks passed
sjsyrek added a commit that referenced this pull request Apr 27, 2026
…#49)

TypeScript 6.0 stopped automatically including all @types/* packages
globally when the `types` compiler option is unset. Jest globals
(beforeAll, afterEach, afterAll, etc.) used in tests/setup.ts and
throughout the test suite stopped resolving:

  tests/setup.ts:10:1 - error TS2304: Cannot find name 'afterEach'.
  tests/setup.ts:28:1 - error TS2304: Cannot find name 'afterAll'.

The main tsconfig.json doesn't need this change because the build only
covers src/ (which uses no jest globals) and `skipLibCheck: true`
already mutes lib-level surprises. The fix lives in jest.config.js's
inline ts-jest tsconfig — both the .ts and .js transformers — because
that's what compiles the test files.

Verified on both currently-pinned TS 5.9.3 and the proposed TS 6.0.2
(via `--no-save` install): \`npm run lint\` clean, \`npm run type-check\`
clean, \`npm test\` 5490 / 5490 tests pass on each.

Unblocks dependabot PR #34 (typescript 5.9.3 → 6.0.2) — pairs with the
earlier #48 (rootDir) fix to complete TS 6.0 compatibility.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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