Repository navigation
fix(51782): treat bare . and .. as relative extends paths - #65822
Open
Sumit G (smg99) wants to merge 1 commit into
Open
Sumit G (smg99) wants to merge 1 commit into
Sumit G (smg99) wants to merge 1 commit into
Conversation
Use PathIsRelative so extends ".." / "." take filesystem resolution instead of module lookup that incorrectly finds a parent tsconfig.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No actionable issues were found in the reviewed changes.
No open issues 🎉
What changed in this PR
Fixes #51782 by routing bare . and .. in extends through filesystem resolution rather than module lookup.
Changes:
- Uses
tspath.PathIsRelativeto recognize relative paths consistently. - Adds regression tests for both bare paths and a
--showConfigdiagnostic baseline.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-rejects-bare-relative-extends.js |
Records the expected TS6053 diagnostic. |
tsc/internal/tsoptions/tsconfigparsing.go |
Updates relative-path detection for extends. |
tsc/internal/tsoptions/tsconfigparsing_test.go |
Tests bare . and .. resolution. |
tsc/internal/execute/tsctests/showconfig_test.go |
Adds a --showConfig regression scenario. |
Review effort: Balanced
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.
Fixes #51782
Summary
extends: ".."(and".") skipped the filesystem branch because only.//../prefixes were treated as relative. They fell through to module/config lookup and incorrectly resolved a parenttsconfig.json.Use
tspath.PathIsRelative, which already treats bare./..as relative, so these take the same filesystem resolution path as.//../.Before / after
With
foo/tsconfig.jsoncontaining"extends": ".."and a parenttsconfig.jsonpresent:Before:
tsc --showConfigsucceeds (0 errors) via module lookup.After:
Checklist
Backlogmilestone (required)mainbranchnpx hereby test(focused:tsoptions+TestShowConfig)npx hereby lint(vianpx hereby validate)npx hereby check:format(vianpx hereby validate/tidy)Made with Cursor