Set symbol/flags only on (fresh) object spreads

If you spread any into an object, the type is any, which should not be
changed.
This commit is contained in:
Nathan Shively-Sanders 2016-12-13 13:52:58 -08:00
parent c76a3a6fef
commit 8dc1747db7

View file

@ -11638,8 +11638,11 @@ namespace ts {
if (propertiesArray.length > 0) {
spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);
}
spread.flags |= propagatedFlags;
spread.symbol = node.symbol;
if (spread.flags & TypeFlags.Object) {
// only set the symbol and flags if this is a (fresh) object type
spread.flags |= propagatedFlags;
spread.symbol = node.symbol;
}
return spread;
}