Skip to content

Commit 720964f

Browse files
committed
Fix bounds check
1 parent 064b296 commit 720964f

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
@@ -19106,7 +19106,7 @@ namespace ts {
1910619106
const flowType = getTypeAtFlowNode(flow.antecedent);
1910719107
const type = getTypeFromFlowType(flowType);
1910819108
const narrowedType = predicate.type ? narrowTypeByTypePredicate(type, predicate, flow.node, /*assumeTrue*/ true) :
19109-
predicate.kind === TypePredicateKind.AssertsIdentifier && predicate.parameterIndex < flow.node.arguments.length ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) :
19109+
predicate.kind === TypePredicateKind.AssertsIdentifier && predicate.parameterIndex >= 0 && predicate.parameterIndex < flow.node.arguments.length ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) :
1911019110
type;
1911119111
return narrowedType === type ? flowType : createFlowType(narrowedType, isIncomplete(flowType));
1911219112
}

0 commit comments

Comments
 (0)