fix(44725): handle this parameter in tagged template call (#44734)

This commit is contained in:
Oleksandr T
2021-06-30 00:11:35 +03:00
committed by GitHub
parent fdc31baffe
commit 114f68cd3d
5 changed files with 90 additions and 2 deletions

View File

@@ -28724,8 +28724,10 @@ namespace ts {
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node: CallLikeExpression): LeftHandSideExpression | undefined {
if (node.kind === SyntaxKind.CallExpression) {
const callee = skipOuterExpressions(node.expression);
const expression = node.kind === SyntaxKind.CallExpression ? node.expression :
node.kind === SyntaxKind.TaggedTemplateExpression ? node.tag : undefined;
if (expression) {
const callee = skipOuterExpressions(expression);
if (isAccessExpression(callee)) {
return callee.expression;
}