microsoft / microsoft/TypeScript
TS 5.6 `files` missing from `--showConfig` (with absolute / ``${configDir}`` `include` paths)
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 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?)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans src/compiler/commandLineParser.ts, au niveau de matchesSpecs et convertToTSConfig, où l'issue signale un traitement différent des chemins d'inclusion absolus et relatifs. Reproduisez les trois cas tsconfig avec tsc --showConfig, déterminez ensuite la sortie de fichiers attendue et vérifiez qu'elle correspond aux fichiers sélectionnés par --listFiles et par le build.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- cli, compilers
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100