Support type arguments after typeof (#15466)
This commit is contained in:
1 parent
c140ed6b53
commit
fa8cb85434
7 files changed
+32
-6
No files matched your search
@@ -521,12 +521,11 @@ function printArrayType(print) {
|
||||
- `TypeofTypeAnnotation`
|
||||
*/
|
||||
function printTypeQuery({ node }, print) {
|
||||
return [
|
||||
"typeof ",
|
||||
...(node.type === "TSTypeQuery"
|
||||
? [print("exprName"), print("typeParameters")]
|
||||
: [print("argument")]),
|
||||
];
|
||||
const argumentPropertyName =
|
||||
node.type === "TSTypeQuery" ? "exprName" : "argument";
|
||||
const typeArgsPropertyName =
|
||||
node.type === "TSTypeQuery" ? "typeParameters" : "typeArguments";
|
||||
return ["typeof ", print(argumentPropertyName), print(typeArgsPropertyName)];
|
||||
}
|
||||
|
||||
function printTypePredicate(path, print) {
|
||||
|
||||
@@ -43,6 +43,7 @@ const additionalVisitorKeys = {
|
||||
AsExpression: ["expression", "typeAnnotation"],
|
||||
AsConstExpression: ["expression"],
|
||||
SatisfiesExpression: ["expression", "typeAnnotation"],
|
||||
TypeofTypeAnnotation: ["argument", "typeArguments"],
|
||||
};
|
||||
|
||||
const excludeKeys = {
|
||||
|
||||
Reference in new issue
Block a user