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:
Nathan Shively-Sanders
2017-12-12 08:34:36 -08:00
parent d53af092c7
commit 43a5a271ee

View File

@@ -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;
}