@@ -5810,11 +5810,6 @@ namespace ts {
58105810 types.push(rspread.right);
58115811 return getSpreadType(types, symbol, aliasSymbol, aliasTypeArguments);
58125812 }
5813- if (right.flags & TypeFlags.Intersection) {
5814- const spreads = map((right as IntersectionType).types,
5815- t => getSpreadType(types.slice().concat([t]), symbol, aliasSymbol, aliasTypeArguments));
5816- return getIntersectionType(spreads, aliasSymbol, aliasTypeArguments);
5817- }
58185813 if (right.flags & TypeFlags.Union) {
58195814 const spreads = map((right as UnionType).types,
58205815 t => getSpreadType(types.slice().concat([t]), symbol, aliasSymbol, aliasTypeArguments));
@@ -5840,11 +5835,6 @@ namespace ts {
58405835 const simplified = getSpreadType([right, (left as SpreadType).right], symbol, aliasSymbol, aliasTypeArguments);
58415836 return getSpreadType([(left as SpreadType).left, simplified], symbol, aliasSymbol, aliasTypeArguments);
58425837 }
5843- if (left.flags & TypeFlags.Intersection) {
5844- const spreads = map((left as IntersectionType).types,
5845- t => getSpreadType(types.slice().concat([t, right]), symbol, aliasSymbol, aliasTypeArguments));
5846- return getIntersectionType(spreads, aliasSymbol, aliasTypeArguments);
5847- }
58485838 if (left.flags & TypeFlags.Union) {
58495839 const spreads = map((left as UnionType).types,
58505840 t => getSpreadType(types.slice().concat([t, right]), symbol, aliasSymbol, aliasTypeArguments));
@@ -5901,9 +5891,9 @@ namespace ts {
59015891 }
59025892 const spread = spreadTypes[id] = createObjectType(TypeFlags.Spread, symbol) as SpreadType;
59035893 Debug.assert(!!(left.flags & (TypeFlags.Spread | TypeFlags.ObjectType)), "Left flags: " + left.flags.toString(2));
5904- Debug.assert(!!(right.flags & (TypeFlags.TypeParameter | TypeFlags.ObjectType)), "Right flags: " + right.flags.toString(2));
5894+ Debug.assert(!!(right.flags & (TypeFlags.TypeParameter | TypeFlags.Intersection | TypeFlags. ObjectType)), "Right flags: " + right.flags.toString(2));
59055895 spread.left = left as SpreadType | ResolvedType;
5906- spread.right = right as TypeParameter | ResolvedType;
5896+ spread.right = right as TypeParameter | IntersectionType | ResolvedType;
59075897 spread.aliasSymbol = aliasSymbol;
59085898 spread.aliasTypeArguments = aliasTypeArguments;
59095899 return spread;
@@ -6953,11 +6943,11 @@ namespace ts {
69536943 spreadTypeRelatedTo(source.right.flags & TypeFlags.ObjectType ? source.left as SpreadType : source,
69546944 target.right.flags & TypeFlags.ObjectType ? target.left as SpreadType : target);
69556945 }
6956- // If both right sides are type parameters, then they must be identical for the spread types to be related.
6946+ // If both right sides are type parameters or intersections , then they must be identical for the spread types to be related.
69576947 // It also means that the left sides are either spread types or object types.
69586948
69596949 // if one left is object and the other is spread, that means the second has another type parameter. which isn't allowed
6960- if (target.right.symbol !== source.right.symbol ) {
6950+ if (target.right !== source.right) {
69616951 return false;
69626952 }
69636953 if (source.left.flags & TypeFlags.Spread && target.left.flags & TypeFlags.Spread) {
0 commit comments