Skip to content

Fix tsconfig include silently dropping files that differ only by base-name case - #64176

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-tsconfig-include-issue
Draft

Fix tsconfig include silently dropping files that differ only by base-name case#64176
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-tsconfig-include-issue

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

On case-insensitive file systems, tsconfig.json include wildcards could silently drop a source file whose base name differs only in case from another file (e.g. src/brand.ts and src/Brand.tsx). No diagnostic was produced — the file simply never entered the program.

Root cause

  • The extension-priority de-duplication logic (hasFileWithHigherPriorityExtension, removeWildcardFilesWithLowerPriorityExtension in tsconfigparsing.go) is meant to drop a file's compiled output (.d.ts, .js) when its source (.ts, .tsx) is also present.
  • It located candidates by folding the whole file path through a case-insensitive canonical key. That fold conflates unrelated files whose base names merely differ in case (brand.ts vs Brand.tsx), causing one to be treated as the other's output and dropped.

Fix

  • Added a shared getExactFile helper that, after a canonical-key lookup, requires the stored entry's file name to be an exact, case-sensitive match before treating it as a priority conflict.
  • Applied it in both the "higher priority" check and the "remove lower priority" cleanup, so:
    • Files differing only by case are never conflated — both stay in the program.
    • Legitimate same-name priority resolution is unchanged (foo.ts still wins over foo.d.ts / foo.js).
// tsconfig.json
{ "include": ["src/**/*"] }
src/brand.ts    // export const brand = "ok";
src/Brand.tsx   // now correctly included instead of silently dropped

Tests

  • Regression test reproducing the reported scenario against a simulated case-insensitive file system.
  • Test guarding the still-intended same-base-name priority behavior (foo.ts over foo.d.ts/foo.js).
  • Direct unit tests for the new getExactFile helper.

…e on case-insensitive file systems

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 5, 2026
Copilot AI and others added 2 commits September 5, 2026 00:16
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tsconfig include dropping Foo.tsx on case-insensitive file systems Fix tsconfig include silently dropping files that differ only by base-name case Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsconfig include silently drops Foo.tsx when foo.ts exists, on a case-insensitive filesystem

2 participants