Cache contextual type for || operator to avoid exponential compile time

This commit is contained in:
Anders Hejlsberg 2017-08-30 16:22:16 -07:00
parent 601c113d93
commit effa2597fa

View File

@ -13059,7 +13059,7 @@ namespace ts {
// expression has no contextual type, the right operand is contextually typed by the type of the left operand.
let type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
type = getTypeOfExpression(binaryExpression.left);
type = getTypeOfExpression(binaryExpression.left, /*cache*/ true);
}
return type;
}