[ts] Add support for template interpolations in types (#12131)

Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
Nicolò Ribaudo
2020-10-14 20:15:42 +02:00
committed by GitHub
parent 9f40d6fcd0
commit 3fd963fdc8
10 changed files with 106 additions and 19 deletions

View File

@@ -1841,7 +1841,13 @@ defineType("TemplateLiteral", {
expressions: {
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("Expression")),
assertEach(
assertNodeType(
"Expression",
// For TypeScript template literal types
"TSType",
),
),
function (node, key, val) {
if (node.quasis.length !== val.length + 1) {
throw new TypeError(