File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -951,11 +951,10 @@ namespace ts {
951
951
if ( ! expression ) {
952
952
return flags & FlowFlags . TrueCondition ? antecedent : unreachableFlow ;
953
953
}
954
- if ( expression . kind === SyntaxKind . TrueKeyword && flags & FlowFlags . FalseCondition ||
955
- expression . kind === SyntaxKind . FalseKeyword && flags & FlowFlags . TrueCondition ) {
956
- if ( ! isExpressionOfOptionalChainRoot ( expression ) ) {
957
- return unreachableFlow ;
958
- }
954
+ if ( ( expression . kind === SyntaxKind . TrueKeyword && flags & FlowFlags . FalseCondition ||
955
+ expression . kind === SyntaxKind . FalseKeyword && flags & FlowFlags . TrueCondition ) &&
956
+ ! isExpressionOfOptionalChainRoot ( expression ) && ! isQuestionQuestionExpression ( expression . parent ) ) {
957
+ return unreachableFlow ;
959
958
}
960
959
if ( ! isNarrowingExpression ( expression ) ) {
961
960
return antecedent ;
Original file line number Diff line number Diff line change @@ -5953,6 +5953,10 @@ namespace ts {
5953
5953
return isOptionalChainRoot ( node . parent ) && node . parent . expression === node ;
5954
5954
}
5955
5955
5956
+ export function isQuestionQuestionExpression ( node : Node ) {
5957
+ return node . kind === SyntaxKind . BinaryExpression && ( < BinaryExpression > node ) . operatorToken . kind === SyntaxKind . QuestionQuestionToken ;
5958
+ }
5959
+
5956
5960
export function isNewExpression ( node : Node ) : node is NewExpression {
5957
5961
return node . kind === SyntaxKind . NewExpression ;
5958
5962
}
You can’t perform that action at this time.
0 commit comments