Skip to content

Commit a271797

Browse files
authored
Use canHaveFlowNode in checkIfExpressionRefinesParameter (#58816)
1 parent f478257 commit a271797

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
@@ -38627,7 +38627,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3862738627
}
3862838628

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

0 commit comments

Comments
 (0)