mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 19:45:07 -06:00
Set symbol on union of spreads
Previously, it was only set on the top-level type, and only if that top-level type was an object type. Now it uses `forEachType` to set the symbol on every object type in the union as well, if `getSpreadType` returns a union.
This commit is contained in:
parent
648bd6e9e0
commit
b69652b137
@ -13917,13 +13917,15 @@ namespace ts {
|
||||
if (propertiesArray.length > 0) {
|
||||
spread = getSpreadType(spread, createObjectLiteralType());
|
||||
}
|
||||
if (spread.flags & TypeFlags.Object) {
|
||||
// only set the symbol and flags if this is a (fresh) object type
|
||||
spread.flags |= propagatedFlags;
|
||||
spread.flags |= TypeFlags.FreshLiteral;
|
||||
(spread as ObjectType).objectFlags |= ObjectFlags.ObjectLiteral;
|
||||
spread.symbol = node.symbol;
|
||||
}
|
||||
// only set the symbol and flags if this is a (fresh) object type
|
||||
forEachType(spread, t => {
|
||||
if (t.flags & TypeFlags.Object) {
|
||||
t.flags |= propagatedFlags;
|
||||
t.flags |= TypeFlags.FreshLiteral;
|
||||
(t as ObjectType).objectFlags |= ObjectFlags.ObjectLiteral;
|
||||
t.symbol = node.symbol
|
||||
}
|
||||
});
|
||||
return spread;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user