[ts] Add support for template interpolations in types (#12131)
Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
@@ -1608,7 +1608,7 @@ export default class ExpressionParser extends LValParser {
|
||||
node.quasis = [curElt];
|
||||
while (!curElt.tail) {
|
||||
this.expect(tt.dollarBraceL);
|
||||
node.expressions.push(this.parseExpression());
|
||||
node.expressions.push(this.parseTemplateSubstitution());
|
||||
this.expect(tt.braceR);
|
||||
node.quasis.push((curElt = this.parseTemplateElement(isTagged)));
|
||||
}
|
||||
@@ -1616,6 +1616,11 @@ export default class ExpressionParser extends LValParser {
|
||||
return this.finishNode(node, "TemplateLiteral");
|
||||
}
|
||||
|
||||
// This is overwritten by the TypeScript plugin to parse template types
|
||||
parseTemplateSubstitution(): N.Expression {
|
||||
return this.parseExpression();
|
||||
}
|
||||
|
||||
// Parse an object literal, binding pattern, or record.
|
||||
|
||||
parseObjectLike<T: N.ObjectPattern | N.ObjectExpression>(
|
||||
|
||||
Reference in New Issue
Block a user