microsoft / microsoft/TypeScript
compilerOptions.plugins is not inherited through tsconfig "extends"
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 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.
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 with mergeCompilerOptions and applyExtendedConfig, following how compilerOptions.plugins reaches ParsedCommandLine.Raw. Reproduce the case with tsc -p . --showConfig, then add regression coverage showing that plugins from an extended tsconfig appears in the resulting configuration without being redeclared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100