fix(44701): allow renaming string literal in rhs/lhs of equality (#44708)

This commit is contained in:
Oleksandr T authored and GitHub committed 2021-07-16 14:45:06 -07:00
1 parent 193b7494d0
commit ba2e2600c8
4 files changed
+27 -7

No files matched your search

+5
View File
@@ -802,6 +802,11 @@ namespace ts {
return contextualType;
}
const parent = node.parent;
if (parent && isBinaryExpression(parent) && isEqualityOperatorKind(parent.operatorToken.kind)) {
return checker.getTypeAtLocation(node === parent.left ? parent.right : parent.left);
}
const ancestorTypeNode = getAncestorTypeNode(node);
return ancestorTypeNode && checker.getTypeAtLocation(ancestorTypeNode);
}