Improve uncalled function checks with parenthesized expressions in condition (#41748)

This commit is contained in:
Oleksandr T
2020-12-05 02:20:14 +02:00
committed by GitHub
parent 360958e04c
commit a5c3cb4194
6 changed files with 177 additions and 97 deletions

View File

@@ -30213,7 +30213,8 @@ namespace ts {
const operator = node.operatorToken.kind;
if (operator === SyntaxKind.AmpersandAmpersandToken || operator === SyntaxKind.BarBarToken || operator === SyntaxKind.QuestionQuestionToken) {
if (operator === SyntaxKind.AmpersandAmpersandToken) {
checkTestingKnownTruthyCallableType(node.left, leftType, isIfStatement(node.parent) ? node.parent.thenStatement : undefined);
const parent = walkUpParenthesizedExpressions(node.parent);
checkTestingKnownTruthyCallableType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : undefined);
}
checkTruthinessOfType(leftType, node.left);
}