(type, access, operator, value, assumeTrue)
| 70815 | }); |
| 70816 | } |
| 70817 | function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { |
| 70818 | if ((operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */) && type.flags & 1048576 /* TypeFlags.Union */) { |
| 70819 | var keyPropertyName = getKeyPropertyName(type); |
| 70820 | if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) { |
| 70821 | var candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value)); |
| 70822 | if (candidate) { |
| 70823 | return operator === (assumeTrue ? 36 /* SyntaxKind.EqualsEqualsEqualsToken */ : 37 /* SyntaxKind.ExclamationEqualsEqualsToken */) ? candidate : |
| 70824 | isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) : |
| 70825 | type; |
| 70826 | } |
| 70827 | } |
| 70828 | } |
| 70829 | return narrowTypeByDiscriminant(type, access, function (t) { return narrowTypeByEquality(t, operator, value, assumeTrue); }); |
| 70830 | } |
| 70831 | function narrowTypeBySwitchOnDiscriminantProperty(type, access, switchStatement, clauseStart, clauseEnd) { |
| 70832 | if (clauseStart < clauseEnd && type.flags & 1048576 /* TypeFlags.Union */ && getKeyPropertyName(type) === getAccessedPropertyName(access)) { |
| 70833 | var clauseTypes = getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd); |
no test coverage detected
searching dependent graphs…