Repository navigation
Conversation
Equality was only checked for pure array types, so a union such as string | number | T[] | T[][] was still widened. Return the input type whenever both sides are the same type. Co-authored-by: park gunhyung <rjsgud49@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
|
Thanks for working on this, @rjsgud49! #2148 was merged yesterday and fixes #2141, so this is already solved on |
This branch was successfully deployed
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
Fixes #2141.
merge(value, value) satisfies typeof valuestarted failing in 1.52 when the type containsstring & {}, or a union of array shapes such asstring[] | string[][]andstring | number | T[] | T[][].toMergedstill type-checks, because its return type isT & S.string & {}counts as an object type, soMergewalked the members ofString(length,toString, and the rest). Unions with more than one array shape were merged member by member, which produced a mixed array like(string | string[])[]that is not assignable back to the original type.Changes
Mergeare the same type.string & {}, as values that are replaced rather than merged into.mergeandMergetype tests.