Skip to content

Commit c5b702d

Browse files
committed
Update LKG
1 parent 1f9904f commit c5b702d

File tree

4 files changed

+548
-10
lines changed

4 files changed

+548
-10
lines changed

bin/tsc.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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 */:

bin/typescriptServices.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14921,15 +14921,21 @@ var ts;
1492114921
}
1492214922
return undefined;
1492314923
}
14924-
function getContextualTypeForArgument(node) {
14925-
var callExpression = node.parent;
14926-
var argIndex = ts.indexOf(callExpression.arguments, node);
14924+
function getContextualTypeForArgument(callTarget, arg) {
14925+
var args = getEffectiveCallArguments(callTarget);
14926+
var argIndex = ts.indexOf(args, arg);
1492714927
if (argIndex >= 0) {
14928-
var signature = getResolvedSignature(callExpression);
14928+
var signature = getResolvedSignature(callTarget);
1492914929
return getTypeAtPosition(signature, argIndex);
1493014930
}
1493114931
return undefined;
1493214932
}
14933+
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
14934+
if (template.parent.kind === 147 /* TaggedTemplateExpression */) {
14935+
return getContextualTypeForArgument(template.parent, substitutionExpression);
14936+
}
14937+
return undefined;
14938+
}
1493314939
function getContextualTypeForBinaryOperand(node) {
1493414940
var binaryExpression = node.parent;
1493514941
var operator = binaryExpression.operator;
@@ -15032,7 +15038,7 @@ var ts;
1503215038
return getContextualTypeForReturnExpression(node);
1503315039
case 145 /* CallExpression */:
1503415040
case 146 /* NewExpression */:
15035-
return getContextualTypeForArgument(node);
15041+
return getContextualTypeForArgument(parent, node);
1503615042
case 148 /* TypeAssertionExpression */:
1503715043
return getTypeFromTypeNode(parent.type);
1503815044
case 157 /* BinaryExpression */:
@@ -15043,6 +15049,9 @@ var ts;
1504315049
return getContextualTypeForElementExpression(node);
1504415050
case 158 /* ConditionalExpression */:
1504515051
return getContextualTypeForConditionalOperand(node);
15052+
case 162 /* TemplateSpan */:
15053+
ts.Debug.assert(parent.parent.kind === 159 /* TemplateExpression */);
15054+
return getContextualTypeForSubstitutionExpression(parent.parent, node);
1504615055
}
1504715056
return undefined;
1504815057
}
@@ -17720,6 +17729,8 @@ var ts;
1772017729
case 145 /* CallExpression */:
1772117730
case 146 /* NewExpression */:
1772217731
case 147 /* TaggedTemplateExpression */:
17732+
case 159 /* TemplateExpression */:
17733+
case 162 /* TemplateSpan */:
1772317734
case 148 /* TypeAssertionExpression */:
1772417735
case 149 /* ParenthesizedExpression */:
1772517736
case 153 /* TypeOfExpression */:

0 commit comments

Comments
 (0)