Repository navigation
fix(type-plus)!: let a later stub.builder().with() object win - #821
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An object initializer now deep-merges over the earlier ones, so a later `.with()` value wins. The partial stub passed at call time still wins over every object initializer, and a function initializer still receives the stub so far and returns the next one, used as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: ae0797e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #821 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 40 40
Lines 173 182 +9
Branches 30 35 +5
=========================================
+ Hits 173 182 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
stub.builder({ a: 1 }).with({ a: 5 }).create()()returned{ a: 1 }: a later.with()object only filled keys the earlier initializers left unset. It now returns{ a: 5 }..with()value wins. Nested keys it does not set are kept.stub.build((s) => ({ a: (s?.a ?? 0) + 1 }))behavior.@examples are pinned instub.builder.spec.ts/stub.build.spec.ts.stub.buildandstub.buildertheir own website sections.type-plusmajor (8.0 is unreleased).Verification
pnpm verifypasses, including type tests on TS 5.4, 5.5, 5.6, 6.0 and 7, and the error snapshots.🤖 Generated with Claude Code