From 70b70fb10c392fa99bf791cdd77c084b426b9ebe Mon Sep 17 00:00:00 2001 From: Tom Jenkinson Date: Mon, 30 Dec 2024 22:24:31 +0000 Subject: [PATCH] Make it work for the `if (!fnOrPromise)` case instead of just `if (!object.fnOrPromise)` --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 74c11b9f51c04..290f15529be1f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -44593,7 +44593,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } - const isUsedInBody = inverted && isIfStatement(condExpr.parent) ? testedSymbol && isSymbolUsedInConditionBody(condExpr, condExpr.parent.parent, testedNode, testedSymbol, /*checkForAssignment*/ true) : testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol, /*checkForAssignment*/ false); + const isUsedInBody = inverted && isIfStatement(condExpr.parent) ? testedSymbol && isSymbolUsedInConditionBody(location, condExpr.parent.parent, testedNode, testedSymbol, /*checkForAssignment*/ true) : testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol, /*checkForAssignment*/ false); const isUsed = testedSymbol && isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol) || isUsedInBody;