microsoft / microsoft/TypeScript

compilerOptions.plugins is not inherited through tsconfig "extends"

Open
#63,975 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Docs
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
⏯ 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.