microsoft / microsoft/TypeScript
compilerOptions.plugins is not inherited through tsconfig "extends"
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
🔎 Search Terms
extends plugins, compilerOptions.plugins extends, plugins not inherited, tsconfig extends inheritance, showConfig plugins
🕗 Version & Regression Information
- This changed between versions 6.0.3 and 7.x
- Verified against e9e477458d7b975ed5e43117fb85f6bc87363a6a
⏯ Playground Link
No response
💻 Code
tsconfig.base.json:
{ "compilerOptions": { "plugins": [{ "name": "my-plugin" }] } }
tsconfig.json:
{ "extends": "./tsconfig.base.json", "compilerOptions": { "module": "nodenext" } }
Then run tsc -p . --showConfig
🙁 Actual behavior
compilerOptions.plugins is absent from the resulting config. A plugins array declared only in a base config never reaches ParsedCommandLine.Raw, it survives only if the leaf tsconfig redeclares it.
🙂 Expected behavior
plugins is inherited from the base config, as with any other compilerOptions entry the child doesn't override (6.0.3 behaviour).
Additional information about the issue
Cause
plugins is the only declared compiler option with no field on core.CompilerOptions, it's carried purely as raw JSON. So mergeCompilerOptions never brings it across, and applyExtendedConfig's raw-JSON merge only handles include/exclude/files/contentMappers/compileOnSave.
Possibly related
root-level watchOptions looks like the same issue.
Fix
I have a fix with tests ready and am happy to open a PR.
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 par mergeCompilerOptions et applyExtendedConfig, en suivant la manière dont compilerOptions.plugins atteint ParsedCommandLine.Raw. Reproduisez le cas avec tsc -p . --showConfig, puis ajoutez une couverture de régression montrant que plugins provenant d’un tsconfig étendu apparaît dans la configuration résultante sans être redéclaré.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 65/100