Skip to content

fix(51782): treat bare . and .. as relative extends paths - #65822

Open
Sumit G (smg99) wants to merge 1 commit into
microsoft:mainfrom
smg99:fix/51782-extends-bare-dotdot
Open

Sumit G (smg99) wants to merge 1 commit into
microsoft:mainfrom
smg99:fix/51782-extends-bare-dotdot

Conversation

@smg99

Copy link
Copy Markdown
Contributor

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 parent tsconfig.json.

Use tspath.PathIsRelative, which already treats bare . / .. as relative, so these take the same filesystem resolution path as ./ / ../.

Before / after

With foo/tsconfig.json containing "extends": ".." and a parent tsconfig.json present:

Before: tsc --showConfig succeeds (0 errors) via module lookup.

After:

tsconfig.json:2:16 - error TS6053: File '..' not found.

Checklist

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the main branch
  • You've successfully run npx hereby test (focused: tsoptions + TestShowConfig)
  • You've successfully run npx hereby lint (via npx hereby validate)
  • You've successfully run npx hereby check:format (via npx hereby validate / tidy)
  • There are new or updated tests validating the change

Made with Cursor

Use PathIsRelative so extends ".." / "." take filesystem resolution
instead of module lookup that incorrectly finds a parent tsconfig.
Copilot AI balanced review requested due to automatic review settings December 5, 2026 13:04
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Dec 5, 2026
@typescript-automation typescript-automation Bot added the For Backlog Bug PRs that fix a backlog bug label Dec 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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.PathIsRelative to recognize relative paths consistently.
  • Adds regression tests for both bare paths and a --showConfig diagnostic 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

tsconfig extends with bare path ".." works when it should not

2 participants