Repository navigation
Description
When tsconfig.json uses both files and include, tsrs builds a different root file list than tsgo at the pinned commit. A .d.ts (or .js with allowJs) next to a file listed in files gets included when include matches it instead of being skipped in favor of the higher-priority source extension, and a file in files that also matches include is added a second time.
Versions
- tsrs:
7.1.0-beta.tsrs2from npm (Version 7.1.0-beta (tsrs 7.1.0-beta.tsrs2, microsoft/TypeScript@3e9236361fa9)),0.25.0-ts7.1.0-betafrom npm, and a source build ofmainatb12862d0 - Reference:
typescript@7.1.0-betafrom npm (Version 7.1.0-beta), andtsgobuilt fromts-refat the pinned commit3e9236361fa97a9e6c685f4833ac457ae2d8c50a(HEAD verified,git diff --exit-code HEAD -- tsc packages/typescriptclean) - Platform: macOS 26.6.2, arm64, APFS (case-insensitive)
Reproduction
tsconfig.json
{
"compilerOptions": { "strict": true, "noEmit": true },
"files": ["a.ts"],
"include": ["*.d.ts"]
}a.ts
export const v: number = fromDeclaration;a.d.ts
declare const fromDeclaration: number;Command run in that directory:
tsrs -p . --pretty false --singleThreadedExpected (tsgo), exit status 2:
a.ts(1,26): error TS2304: Cannot find name 'fromDeclaration'.
Actual (tsrs), exit status 0:
(No output. --fast gives the same result.)
tsgo skips a.d.ts because a.ts is already in the program via files with a higher-priority extension. tsrs includes a.d.ts as a root file, so fromDeclaration resolves and the error is missed.
The same underlying issue also causes:
- TS5055 on a second in-place declaration build: with
"declaration": true,"files": ["index.ts"], and"include": ["*.d.ts"], the first-p . --pretty falserun emitsindex.d.tsand exits 0, but a second run picks upindex.d.tsas an input and fails (exit status 1) witherror TS5055: Cannot write file '<dir>/index.d.ts' because it would overwrite input file.(tsgoexits 0 with no output). - Duplicate
--explainFilesreason: with"files": ["a.ts"], "include": ["*.ts"](or"files": ["./a.ts", "a.ts"]),Part of 'files' list in tsconfig.jsonis printed twice fora.ts. - False TS1149 on case-insensitive volumes: with
a.tson disk and"files": ["A.ts"], "include": ["*.ts"],tsgoexits 0 with no output whiletsrsexits 2 witherror TS1149: File name '<dir>/a.ts' differs from already included file name '<dir>/A.ts' only in casing. allowJssibling inclusion: witha.tsanda.json disk and"files": ["a.ts"], "include": ["*.js"],--listFilesOnlylistsa.jsintsrsbut not intsgo.
Cause
In get_file_names_from_config_specs, literal_file_map is keyed by the raw spec string from files instead of the normalized absolute path.
Go at the pin (tsoptions/tsconfigparsing.go lines 1883 to 1885):
for i := range validatedFilesSpec {
literalFileMap.Set(keyMapper(validatedFileNames[i]), validatedFileNames[i])
}Rust on main (tsrs_tsoptions/src/tsconfigparsing.rs lines 3080 to 3083):
literal_file_map.extend(validated_files_spec.iter().map(|file_name| {
let file = tspath::get_normalized_absolute_path(file_name, &base_path);
(key_mappper(file_name), file)
}));Because the map key is e.g. a.ts or ./a.ts while every subsequent lookup in the function (lines 3135, 3154, 3162, and 3180) passes key_mappper on a normalized absolute path, literal_file_map.contains_key never matches.
Go used keyMappper(fileName) until ed4807212c28 (microsoft/TypeScript#64159, "Strongly type file paths"), which changed it to keyMapper(validatedFileNames[i]). That commit is an ancestor of the pin, and this change was missed in notes/typescript-623-ports.md (section 31).
Suggested fix
literal_file_map.extend(validated_files_spec.iter().map(|file_name| {
let file = tspath::get_normalized_absolute_path(file_name, &base_path);
- (key_mappper(file_name), file)
+ (key_mappper(&file), file)
}));I tested this one-line change locally on b12862d0:
- All the reproduction cases above match the pinned
tsgooutput and exit status. tools/regressions.shpasses 54 of 54 cases.tsrs-test run --suite allhas the same pass set before and after: 13,695 passing, and the same five non-passing cases on both sides.
I didn't run the determinism gate, the Fourslash gate, cargo test or Clippy.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
oxc-captain commentedon Nov 17, 2026
Triage failed unexpectedly (attempt 1 of 3).
Run: https://github.com/oxc-project/tsrs/actions/runs/44052824412
I can retry if a new comment provides more information or asks me to try again.
Error: