mizdra / mizdra/css-modules-kit
An earlier entry of an `extends` array takes precedence over a later one for `cmkOptions`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 197
- Forks
- 15
- Avg merge
- 1h 33m
- Merged PRs (30d)
- 9
Description
Summary
When extends in tsconfig.json is an array, cmkOptions of an earlier entry take precedence over those of a later entry. TypeScript resolves the same conflict in the opposite way: the later entry wins.
Details
tsconfig.base1.json:
{
"compilerOptions": { "module": "esnext" },
"cmkOptions": { "dtsOutDir": "generated1" }
}
tsconfig.base2.json:
{
"compilerOptions": { "module": "es2015" },
"cmkOptions": { "dtsOutDir": "generated2" }
}
tsconfig.json:
{
"extends": ["./tsconfig.base1.json", "./tsconfig.base2.json"]
}
Result of readConfigFile:
| Option | Value | Taken from |
|---|---|---|
compilerOptions.module (resolved by TypeScript) |
ES2015 |
tsconfig.base2.json |
dtsOutDir (resolved by css-modules-kit) |
<rootDir>/generated1 |
tsconfig.base1.json |
readConfigFile merges the options of the extended files in the order TypeScript lists them, and an option that is already set is never overwritten. This gives the right precedence for a chain (tsconfig.json → base2 → base1), but the wrong one for an array.
Expected behavior
dtsOutDir is <rootDir>/generated2. For every option of cmkOptions, a later entry of the extends array takes precedence over an earlier one, as TypeScript does for compilerOptions.
🤖 Generated with Claude Code
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 at readConfigFile, using the three tsconfig.json examples in the issue to reproduce the precedence difference between an extends array and a chain. Inspect how extended options are merged, then verify that the later array entry supplies dtsOutDir while preserving TypeScript's compilerOptions behavior. Done means the result resolves dtsOutDir to /generated2.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100