Remove incorrect call to checkTruthinessExpression (#59507)

This commit is contained in:
Ryan Cavanaugh
2024-08-02 12:51:07 -07:00
committed by GitHub
parent e078a9367e
commit 6f646429e0
7 changed files with 48 additions and 25 deletions
+1 -1
View File
@@ -44186,7 +44186,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
bothHelper(location, body);
return;
}
const type = location === condExpr ? condType : checkTruthinessExpression(location);
const type = location === condExpr ? condType : checkExpression(location);
if (type.flags & TypeFlags.EnumLiteral && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & SymbolFlags.Enum) {
// EnumLiteral type at condition with known value is always truthy or always falsy, likely an error
error(location, Diagnostics.This_condition_will_always_return_0, !!(type as LiteralType).value ? "true" : "false");