Merge pull request #22251 from jack-williams/jack-williams/no-implicit-symbol-to-string

Fix #19666: Check for symbol types in template expressions
This commit is contained in:
Mohamed Hegazy
2018-03-30 09:32:11 -07:00
committed by GitHub
10 changed files with 201 additions and 1 deletions

View File

@@ -19684,7 +19684,9 @@ namespace ts {
// A place where we actually *are* concerned with the expressions' types are
// in tagged templates.
forEach(node.templateSpans, templateSpan => {
checkExpression(templateSpan.expression);
if (maybeTypeOfKind(checkExpression(templateSpan.expression), TypeFlags.ESSymbolLike)) {
error(templateSpan.expression, Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType));
}
});
return stringType;