Repository navigation
Conversation
🦋 Changeset detectedLatest commit: e4122a3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
readConfigFile merged the extended tsconfig files in the flattened order of extendedSourceFiles and never overwrote an option that was already set. That is right for a chain of extends, but for an extends array it let the earliest entry win, while TypeScript lets the latest entry win. Resolve the inherited options per extends entry instead, so a later entry (and the files it extends) takes precedence over an earlier one. Fixes mizdra#453
RClaudiuM
force-pushed
the
fix/453-extends-array-precedence
branch
from
November 10, 2026 17:01
7651013 to
e4122a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #453
What
readConfigFilemerged the extended tsconfig files in the flattened order ofextendedSourceFilesand never overwrote an option that was already set. For a chain ofextends, that order puts the nearest file first, so the precedence was right. For anextendsarray it let the earliest entry win, while TypeScript lets the latest entry win forcompilerOptions.Now the inherited options are resolved per
extendsentry. A later entry, together with the files it extends in turn, takes precedence over an earlier one. The file's owncmkOptionsstill win over everything it extends. Diagnostics are collected the same way as before.extendedSourceFilesonly gives the flattened list, so the direct entries are recovered by skipping the files each entry extends in turn. There is one case this can't tell apart: an entry that also appears earlier in the list because an earlier entry extends it ("extends": ["./a.json", "./c.json"]wherea.jsonextendsc.json). That case keeps the old precedence.Tests
Two tests added to
packages/core/src/config.test.ts:prefers a later entry of an `extends` array over an earlier one: the example from the issue (dtsOutDiris nowgenerated2, same source ascompilerOptions.module)prefers the tsconfig extended by a later entry of an `extends` array over an earlier entryBefore the fix, both tests fail (
dtsOutDirresolves togenerated1). After the fix:vp test: 43 files, 502 passedvp check: passesvp run build: passesI did not run
vp run vscode-testlocally.