(expr)
| 45387 | return ts.isTypeOfExpression(expr1) && isNarrowableOperand(expr1.expression) && ts.isStringLiteralLike(expr2); |
| 45388 | } |
| 45389 | function isNarrowingBinaryExpression(expr) { |
| 45390 | switch (expr.operatorToken.kind) { |
| 45391 | case 63 /* SyntaxKind.EqualsToken */: |
| 45392 | case 75 /* SyntaxKind.BarBarEqualsToken */: |
| 45393 | case 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */: |
| 45394 | case 77 /* SyntaxKind.QuestionQuestionEqualsToken */: |
| 45395 | return containsNarrowableReference(expr.left); |
| 45396 | case 34 /* SyntaxKind.EqualsEqualsToken */: |
| 45397 | case 35 /* SyntaxKind.ExclamationEqualsToken */: |
| 45398 | case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: |
| 45399 | case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: |
| 45400 | return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || |
| 45401 | isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); |
| 45402 | case 102 /* SyntaxKind.InstanceOfKeyword */: |
| 45403 | return isNarrowableOperand(expr.left); |
| 45404 | case 101 /* SyntaxKind.InKeyword */: |
| 45405 | return isNarrowingExpression(expr.right); |
| 45406 | case 27 /* SyntaxKind.CommaToken */: |
| 45407 | return isNarrowingExpression(expr.right); |
| 45408 | } |
| 45409 | return false; |
| 45410 | } |
| 45411 | function isNarrowableOperand(expr) { |
| 45412 | switch (expr.kind) { |
| 45413 | case 212 /* SyntaxKind.ParenthesizedExpression */: |
no test coverage detected