(node)
| 78012 | return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); |
| 78013 | } |
| 78014 | function computeExhaustiveSwitchStatement(node) { |
| 78015 | if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { |
| 78016 | var operandType = getTypeOfExpression(node.expression.expression); |
| 78017 | var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false); |
| 78018 | // notEqualFacts states that the type of the switched value is not equal to every type in the switch. |
| 78019 | var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true); |
| 78020 | var type_6 = getBaseConstraintOfType(operandType) || operandType; |
| 78021 | // Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types. |
| 78022 | if (type_6.flags & 3 /* TypeFlags.AnyOrUnknown */) { |
| 78023 | return (556800 /* TypeFacts.AllTypeofNE */ & notEqualFacts_1) === 556800 /* TypeFacts.AllTypeofNE */; |
| 78024 | } |
| 78025 | return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* TypeFlags.Never */); |
| 78026 | } |
| 78027 | var type = getTypeOfExpression(node.expression); |
| 78028 | if (!isLiteralType(type)) { |
| 78029 | return false; |
| 78030 | } |
| 78031 | var switchTypes = getSwitchClauseTypes(node); |
| 78032 | if (!switchTypes.length || ts.some(switchTypes, isNeitherUnitTypeNorNever)) { |
| 78033 | return false; |
| 78034 | } |
| 78035 | return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); |
| 78036 | } |
| 78037 | function functionHasImplicitReturn(func) { |
| 78038 | return func.endFlowNode && isReachableFlowNode(func.endFlowNode); |
| 78039 | } |
no test coverage detected