chore(tsconfig): explicit rootDir for TypeScript 6.0 compatibility#48
Merged
chore(tsconfig): explicit rootDir for TypeScript 6.0 compatibility#48
Conversation
…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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
Size: Small ✓
One-line config change.
🤖 Generated with Claude Code