Skip to content

Commit

Permalink
Use canHaveFlowNode in checkIfExpressionRefinesParameter (#58816)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored Oct 31, 2024
1 parent f478257 commit a271797
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38627,7 +38627,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}

function checkIfExpressionRefinesParameter(func: FunctionLikeDeclaration, expr: Expression, param: ParameterDeclaration, initType: Type): Type | undefined {
const antecedent = (expr as Expression & { flowNode?: FlowNode; }).flowNode ||
const antecedent = canHaveFlowNode(expr) && expr.flowNode ||
expr.parent.kind === SyntaxKind.ReturnStatement && (expr.parent as ReturnStatement).flowNode ||
createFlowNode(FlowFlags.Start, /*node*/ undefined, /*antecedent*/ undefined);
const trueCondition = createFlowNode(FlowFlags.TrueCondition, expr, antecedent);
Expand Down

0 comments on commit a271797

Please sign in to comment.