Skip to content

Commit effa259

Browse files
committed
Cache contextual type for || operator to avoid exponential compile time
1 parent 601c113 commit effa259

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13059,7 +13059,7 @@ namespace ts {
1305913059
// expression has no contextual type, the right operand is contextually typed by the type of the left operand.
1306013060
let type = getContextualType(binaryExpression);
1306113061
if (!type && node === binaryExpression.right) {
13062-
type = getTypeOfExpression(binaryExpression.left);
13062+
type = getTypeOfExpression(binaryExpression.left, /*cache*/ true);
1306313063
}
1306413064
return type;
1306513065
}

0 commit comments

Comments
 (0)