microsoft / microsoft/TypeScript
TS 5.6 `files` missing from `--showConfig` (with absolute / ``${configDir}`` `include` paths)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 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?)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in src/compiler/commandLineParser.ts, in matchesSpecs e convertToTSConfig, dove l'issue segnala una gestione diversa dei percorsi di inclusione assoluti e relativi. Riproduci i tre casi tsconfig con tsc --showConfig, determina quindi l'output dei file previsto e verifica che corrisponda ai file selezionati da --listFiles e dalla build.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- cli, compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100