(type, expr, assumeTrue)
| 70839 | return narrowTypeByDiscriminant(type, access, function (t) { return narrowTypeBySwitchOnDiscriminant(t, switchStatement, clauseStart, clauseEnd); }); |
| 70840 | } |
| 70841 | function narrowTypeByTruthiness(type, expr, assumeTrue) { |
| 70842 | if (isMatchingReference(reference, expr)) { |
| 70843 | return type.flags & 2 /* TypeFlags.Unknown */ && assumeTrue ? nonNullUnknownType : |
| 70844 | getTypeWithFacts(type, assumeTrue ? 4194304 /* TypeFacts.Truthy */ : 8388608 /* TypeFacts.Falsy */); |
| 70845 | } |
| 70846 | if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) { |
| 70847 | type = getTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); |
| 70848 | } |
| 70849 | var access = getDiscriminantPropertyAccess(expr, type); |
| 70850 | if (access) { |
| 70851 | return narrowTypeByDiscriminant(type, access, function (t) { return getTypeWithFacts(t, assumeTrue ? 4194304 /* TypeFacts.Truthy */ : 8388608 /* TypeFacts.Falsy */); }); |
| 70852 | } |
| 70853 | return type; |
| 70854 | } |
| 70855 | function isTypePresencePossible(type, propName, assumeTrue) { |
| 70856 | var prop = getPropertyOfType(type, propName); |
| 70857 | if (prop) { |
no test coverage detected