@@ -14333,15 +14333,21 @@ var ts;
1433314333 }
1433414334 return undefined;
1433514335 }
14336- function getContextualTypeForArgument(node ) {
14337- var callExpression = node.parent ;
14338- var argIndex = ts.indexOf(callExpression.arguments, node );
14336+ function getContextualTypeForArgument(callTarget, arg ) {
14337+ var args = getEffectiveCallArguments(callTarget) ;
14338+ var argIndex = ts.indexOf(args, arg );
1433914339 if (argIndex >= 0) {
14340- var signature = getResolvedSignature(callExpression );
14340+ var signature = getResolvedSignature(callTarget );
1434114341 return getTypeAtPosition(signature, argIndex);
1434214342 }
1434314343 return undefined;
1434414344 }
14345+ function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
14346+ if (template.parent.kind === 147 /* TaggedTemplateExpression */) {
14347+ return getContextualTypeForArgument(template.parent, substitutionExpression);
14348+ }
14349+ return undefined;
14350+ }
1434514351 function getContextualTypeForBinaryOperand(node) {
1434614352 var binaryExpression = node.parent;
1434714353 var operator = binaryExpression.operator;
@@ -14444,7 +14450,7 @@ var ts;
1444414450 return getContextualTypeForReturnExpression(node);
1444514451 case 145 /* CallExpression */:
1444614452 case 146 /* NewExpression */:
14447- return getContextualTypeForArgument(node);
14453+ return getContextualTypeForArgument(parent, node);
1444814454 case 148 /* TypeAssertionExpression */:
1444914455 return getTypeFromTypeNode(parent.type);
1445014456 case 157 /* BinaryExpression */:
@@ -14455,6 +14461,9 @@ var ts;
1445514461 return getContextualTypeForElementExpression(node);
1445614462 case 158 /* ConditionalExpression */:
1445714463 return getContextualTypeForConditionalOperand(node);
14464+ case 162 /* TemplateSpan */:
14465+ ts.Debug.assert(parent.parent.kind === 159 /* TemplateExpression */);
14466+ return getContextualTypeForSubstitutionExpression(parent.parent, node);
1445814467 }
1445914468 return undefined;
1446014469 }
@@ -17132,6 +17141,8 @@ var ts;
1713217141 case 145 /* CallExpression */:
1713317142 case 146 /* NewExpression */:
1713417143 case 147 /* TaggedTemplateExpression */:
17144+ case 159 /* TemplateExpression */:
17145+ case 162 /* TemplateSpan */:
1713517146 case 148 /* TypeAssertionExpression */:
1713617147 case 149 /* ParenthesizedExpression */:
1713717148 case 153 /* TypeOfExpression */:
0 commit comments