mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
object spreads to {}
Specifically, when spreading `object` on the right, spread now returns the left of the spread; previously it returned `object`, which loses everything to the left.
This commit is contained in:
@@ -8327,10 +8327,7 @@ namespace ts {
|
||||
if (right.flags & TypeFlags.Union) {
|
||||
return mapType(right, t => getSpreadType(left, t, symbol, propagatedFlags));
|
||||
}
|
||||
if (right.flags & TypeFlags.NonPrimitive) {
|
||||
return nonPrimitiveType;
|
||||
}
|
||||
if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.EnumLike)) {
|
||||
if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive)) {
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user