microsoft / microsoft/TypeScript
TS 5.6 `files` missing from `--showConfig` (with absolute / ``${configDir}`` `include` paths)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
"--showConfig", "include", "configDir", "files", "extends", "absolute"
🕗 Version & Regression Information
- Tested versions:
3.2.1(--showConfigwas introduced here)3.2.45.5.2(${configDir}was introduced here)latest=>5.6.3next=>5.7.0-dev.20241011
- This is the behaviour in every version I tried, and I reviewed the FAQ for entries about "configDir", "showConfig", "absolute".
- I was unable to test this on prior versions because
--showConfigcli flag was introduced in TS 3.2 andconfigDirtemplate variable was introduced in TS 5.5.
⏯ Playground Link
No response
💻 Code
// tsconfig-rel.json
{
//...
"include": ["src/**/*"]
}
// tsconfig-abs.json
{
//...
"include": ["/path/to/src/**/*"]
}
// tsconfig-cnf.json
{
//...
"include": ["${configDir}/src/**/*"]
}
// src/index.ts
console.log("dummy");
🙁 Actual behavior
❌ Printing config yields different results.
npx tsc --project tsconfig-rel.json --showConfig
npx tsc --project tsconfig-abs.json --showConfig
npx tsc --project tsconfig-cnf.json --showConfig
- For absolute include paths the
filesproperty is missing. ${configDir}is resolved to and behaves / fails the same as absolute paths.
{
"compilerOptions": {...},
- "files": [
- "./src/index.ts"
- ],
"include": [
- "src/**/*"
+ "/path/to/src/**/*"
],
"exclude": [...]
}
✅ Listing files yields the same output.
npx tsc --project tsconfig-rel.json --listFiles --noEmit
npx tsc --project tsconfig-abs.json --listFiles --noEmit
npx tsc --project tsconfig-cnf.json --listFiles --noEmit
List of files printed to stdout, containing
/path/to/src/index.ts/path/to/node_modules/**/*.d.tsentries from npm dependency type declarations./path/to/node_modules/typescript/lib/lib.decorators.d.ts(only in TS 5 of course)/path/to/node_modules/typescript/lib/lib.decorators.legacy.d.ts(only in TS 5 of course)
✅ Building yields the same index.js file content for all configs.
npx tsc --project tsconfig-rel.json
npx tsc --project tsconfig-abs.json
npx tsc --project tsconfig-cnf.json
🙂 Expected behavior
--showConfig should show the same files for configs that build the same files and show the same listing for --listFiles.
Additional information about the issue
includeRe in matchesSpecs seems to be calculated differently for absolute / relative paths, resulting in all files being filtered out in convertToTSConfig.
I can't tell though which behaviour is actually expected. (keep files or filter files out?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/compiler/commandLineParser.ts at matchesSpecs and convertToTSConfig, where the issue reports different handling of absolute and relative include paths. Reproduce the three tsconfig cases with tsc --showConfig, then determine the expected files output and verify that it matches the files selected by --listFiles and the build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100