(type, expr, assumeTrue)
| 70869 | return type; |
| 70870 | } |
| 70871 | function narrowTypeByBinaryExpression(type, expr, assumeTrue) { |
| 70872 | switch (expr.operatorToken.kind) { |
| 70873 | case 63 /* SyntaxKind.EqualsToken */: |
| 70874 | case 75 /* SyntaxKind.BarBarEqualsToken */: |
| 70875 | case 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */: |
| 70876 | case 77 /* SyntaxKind.QuestionQuestionEqualsToken */: |
| 70877 | return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue); |
| 70878 | case 34 /* SyntaxKind.EqualsEqualsToken */: |
| 70879 | case 35 /* SyntaxKind.ExclamationEqualsToken */: |
| 70880 | case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: |
| 70881 | case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: |
| 70882 | var operator = expr.operatorToken.kind; |
| 70883 | var left = getReferenceCandidate(expr.left); |
| 70884 | var right = getReferenceCandidate(expr.right); |
| 70885 | if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { |
| 70886 | return narrowTypeByTypeof(type, left, operator, right, assumeTrue); |
| 70887 | } |
| 70888 | if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { |
| 70889 | return narrowTypeByTypeof(type, right, operator, left, assumeTrue); |
| 70890 | } |
| 70891 | if (isMatchingReference(reference, left)) { |
| 70892 | return narrowTypeByEquality(type, operator, right, assumeTrue); |
| 70893 | } |
| 70894 | if (isMatchingReference(reference, right)) { |
| 70895 | return narrowTypeByEquality(type, operator, left, assumeTrue); |
| 70896 | } |
| 70897 | if (strictNullChecks) { |
| 70898 | if (optionalChainContainsReference(left, reference)) { |
| 70899 | type = narrowTypeByOptionalChainContainment(type, operator, right, assumeTrue); |
| 70900 | } |
| 70901 | else if (optionalChainContainsReference(right, reference)) { |
| 70902 | type = narrowTypeByOptionalChainContainment(type, operator, left, assumeTrue); |
| 70903 | } |
| 70904 | } |
| 70905 | var leftAccess = getDiscriminantPropertyAccess(left, type); |
| 70906 | if (leftAccess) { |
| 70907 | return narrowTypeByDiscriminantProperty(type, leftAccess, operator, right, assumeTrue); |
| 70908 | } |
| 70909 | var rightAccess = getDiscriminantPropertyAccess(right, type); |
| 70910 | if (rightAccess) { |
| 70911 | return narrowTypeByDiscriminantProperty(type, rightAccess, operator, left, assumeTrue); |
| 70912 | } |
| 70913 | if (isMatchingConstructorReference(left)) { |
| 70914 | return narrowTypeByConstructor(type, operator, right, assumeTrue); |
| 70915 | } |
| 70916 | if (isMatchingConstructorReference(right)) { |
| 70917 | return narrowTypeByConstructor(type, operator, left, assumeTrue); |
| 70918 | } |
| 70919 | break; |
| 70920 | case 102 /* SyntaxKind.InstanceOfKeyword */: |
| 70921 | return narrowTypeByInstanceof(type, expr, assumeTrue); |
| 70922 | case 101 /* SyntaxKind.InKeyword */: |
| 70923 | if (ts.isPrivateIdentifier(expr.left)) { |
| 70924 | return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); |
| 70925 | } |
| 70926 | var target = getReferenceCandidate(expr.right); |
| 70927 | var leftType = getTypeOfNode(expr.left); |
| 70928 | if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { |
no test coverage detected
searching dependent graphs…