Repository navigation
fix(tsconfig): resolve non-relative imports against baseUrl - #1098
Open
Balghisa12 wants to merge 1 commit into
Open
Balghisa12 wants to merge 1 commit into
Balghisa12 wants to merge 1 commit into
Conversation
resolve_alias returned None whenever compilerOptions.paths was empty, so a tsconfig that sets only baseUrl resolved no non-relative import. tsc resolves such specifiers against baseUrl, both without paths and when no paths pattern matches; the resolver now does the same, after trying paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Pull Request
Linked issue
No existing issue. Found while evaluating the graph on a NestJS monorepo. Related to #1030 (workspace packages), which is a separate gap.
What & why
TsconfigResolver.resolve_aliasreturnedNonewhenevercompilerOptions.pathswas empty, so a tsconfig that sets onlybaseUrlresolved no non-relative import.tscresolves such specifiers againstbaseUrl, both withoutpathsand when nopathspattern matches. The resolver now does the same, after tryingpaths.docs/FEATURES.mdalready listspaths/baseUrlresolution, so no docs change.On a NestJS service of 1,181 TypeScript files that imports
src/...with"baseUrl": "./"and nopaths:src/...import edges: 1,849 → 44 (the 44 point at generated clients absent from the checkout);"paths": { "src/*": ["src/*"] }, which takesimporters_offor one service from 14 to 35 of its 35 importers and the real callerscallers_offinds for its method from 4 to all 6.How it was tested
tsc5.8.3 with--traceResolutionon two fixtures,baseUrlalone andbaseUrlwith a non-matchingpathsentry, resolvessrc/lib/utilthroughbaseUrlin both.Checklist
uv run pytest tests/ --tb=short -quv run ruff check code_review_graph/uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optionaldocs/, docstrings)🤖 Generated with Claude Code