microsoft / microsoft/TypeScript
compilerOptions.plugins is not inherited through tsconfig "extends"
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
🔎 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.
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 da mergeCompilerOptions e applyExtendedConfig, seguendo come compilerOptions.plugins raggiunge ParsedCommandLine.Raw. Riproduci il caso con tsc -p . --showConfig, quindi aggiungi una copertura di regressione che mostri che plugins proveniente da un tsconfig esteso appare nella configurazione risultante senza essere dichiarato nuovamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 65/100