Merge pull request #1415 from spanishpear/master
Feat: support Typescript type arguments on tagged template literals
This commit is contained in:
commit
23af4519a2
2 changed files with 14 additions and 1 deletions
|
|
@ -1587,7 +1587,12 @@ function genericPrintNoParens(path: any, options: any, print: any) {
|
|||
}
|
||||
|
||||
case "TaggedTemplateExpression":
|
||||
return concat([path.call(print, "tag"), path.call(print, "quasi")]);
|
||||
parts.push(path.call(print, "tag"));
|
||||
if (n.typeParameters) {
|
||||
parts.push(path.call(print, "typeParameters"));
|
||||
}
|
||||
parts.push(path.call(print, "quasi"));
|
||||
return concat(parts);
|
||||
|
||||
// These types are unprintable because they serve as abstract
|
||||
// supertypes for other (printable) types.
|
||||
|
|
|
|||
|
|
@ -331,6 +331,14 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
|
|||
check(["type Class<T> = new (...args: any) => T;"]);
|
||||
|
||||
check(["type T1 = [...Array<any>];", "type T2 = [...any[]];"]);
|
||||
check([
|
||||
"const a = styled.h1<{",
|
||||
" $upsideDown?: boolean;",
|
||||
"}>`",
|
||||
' ${props => props.$upsideDown && "transform: rotate(180deg);"}',
|
||||
" text-align: center;",
|
||||
"`;",
|
||||
]);
|
||||
|
||||
check([
|
||||
"type Color = [r: number, g: number, b: number, a?: number];",
|
||||
|
|
|
|||
Loading…
Reference in a new issue