(flow)
| 70569 | return createFlowType(narrowedType, isIncomplete(flowType)); |
| 70570 | } |
| 70571 | function getTypeAtSwitchClause(flow) { |
| 70572 | var expr = flow.switchStatement.expression; |
| 70573 | var flowType = getTypeAtFlowNode(flow.antecedent); |
| 70574 | var type = getTypeFromFlowType(flowType); |
| 70575 | if (isMatchingReference(reference, expr)) { |
| 70576 | type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); |
| 70577 | } |
| 70578 | else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { |
| 70579 | type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); |
| 70580 | } |
| 70581 | else { |
| 70582 | if (strictNullChecks) { |
| 70583 | if (optionalChainContainsReference(expr, reference)) { |
| 70584 | type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); |
| 70585 | } |
| 70586 | else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { |
| 70587 | type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); |
| 70588 | } |
| 70589 | } |
| 70590 | var access = getDiscriminantPropertyAccess(expr, type); |
| 70591 | if (access) { |
| 70592 | type = narrowTypeBySwitchOnDiscriminantProperty(type, access, flow.switchStatement, flow.clauseStart, flow.clauseEnd); |
| 70593 | } |
| 70594 | } |
| 70595 | return createFlowType(type, isIncomplete(flowType)); |
| 70596 | } |
| 70597 | function getTypeAtFlowBranchLabel(flow) { |
| 70598 | var antecedentTypes = []; |
| 70599 | var subtypeReduction = false; |
no test coverage detected
searching dependent graphs…