Skip to content

fix(tsoptions): key literal files entries by their absolute path - #1021

Merged
camc314 merged 1 commit into
oxc-project:mainfrom
magurotuna:fix/files-literal-absolute-key
Nov 18, 2026
Merged

camc314 merged 1 commit into
oxc-project:mainfrom
magurotuna:fix/files-literal-absolute-key

Conversation

@magurotuna

Copy link
Copy Markdown
Member

What and why

With "files": ["a.ts"] and "include": ["*.d.ts"], tsrs included a.d.ts, which tsgo skips. This hid TS2304 in the reproduction in #1010. Overlapping files and include entries, or two files entries for one path, also repeated the Part of 'files' list reason.

literal_file_map used the raw spec text as its key, but the later lookups use absolute paths, so they never found a literal file. It now uses the absolute file name, as Go getFileNamesFromConfigSpecs does. This is the fix that @kjmin-dev found and suggested in #1010; this PR adds regression tests for it.

Closes #1010

Evidence

  • New regression cases files-literal-dts-sibling and files-and-include-overlap-rootdir, with expected output from tsgo: both fail on main and pass with the fix. tools/regressions.sh: 56/56 pass.
  • tsrs_tsoptions tests: 57 passed, 1 ignored. recycle_checkers: passed.
  • Clippy for tsrs_tsoptions, cargo fmt --check and node tools/lint/source.mjs: clean.
  • tsrs-test run --suite all --timeout 300: the same 13,696 tests pass as on main.

AI assistance: written with Claude Code.
Co-authored-by: Kyoungjun Min 7831054+kjmin-dev@users.noreply.github.com

`get_file_names_from_config_specs` stored each literal `files` entry in
`literal_file_map` under the key of the raw spec text (`a.ts`), but every
later lookup uses the key of an absolute file name. So the lookups never
matched a literal entry. Go `getFileNamesFromConfigSpecs`
(`tsconfigparsing.go:1883`) keys the map by `validatedFileNames[i]`, the
absolute name, and tsrs now does the same.

There were two effects:

- If `files` names `a.ts` and `include` matches only a sibling with a lower
  extension priority (`a.d.ts`, or `a.js` with `allowJs`), tsgo drops the
  sibling. tsrs put it in the program, so the diagnostics and the exit code
  changed.
- If a file is in `files` and also matches `include` (or two `files`
  entries spell one path, such as `a.ts` and `./a.ts`), tsrs added the root
  file again. `--explainFiles` and the diagnostics that print "The file is in
  the program because:" (for example TS6059) repeated the line
  `Part of 'files' list in tsconfig.json`.

Reported in oxc-project#1010.

Tests: the regression cases `files-literal-dts-sibling` and
`files-and-include-overlap-rootdir`, with expected output from tsgo at the
pinned commit. Both fail without the fix.

AI assistance: written with Claude Code.
Co-authored-by: Kyoungjun Min <7831054+kjmin-dev@users.noreply.github.com>
@codspeed

codspeed Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

βœ… 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing magurotuna:fix/files-literal-absolute-key (50c2cb4) with main (7eb504d)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@camc314
camc314 added this pull request to the merge queue Nov 18, 2026
Merged via the queue into oxc-project:main with commit 49c8d67 Nov 18, 2026
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

tsconfig files + include: listed files don't suppress .d.ts siblings or duplicate matches

2 participants