Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit cd810f3

Browse files
committed
Update visitor keys
1 parent 1add926 commit cd810f3

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

lib/ast-node-types.js

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ module.exports = {
106106
/**
107107
* TS-prefixed nodes
108108
*/
109+
TSAbstractClassDeclaration: "TSAbstractClassDeclaration",
109110
TSAbstractClassProperty: "TSAbstractClassProperty",
110111
TSAbstractKeyword: "TSAbstractKeyword",
111112
TSAbstractMethodDefinition: "TSAbstractMethodDefinition",

lib/visitor-keys.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,37 @@ module.exports = Evk.unionWith({
1717
ClassExpression: ["superTypeParameters", "typeParameters"],
1818
ClassImplements: ["typeParameters"],
1919
ClassProperty: ["typeAnnotation"],
20-
FunctionDeclaration: ["returnType"],
20+
FunctionDeclaration: ["returnType", "typeParameters"],
2121
FunctionExpression: ["returnType", "typeParameters"],
2222
Identifier: ["typeAnnotation"],
2323
InterfaceDeclaration: ["typeParameters"],
2424
NewExpression: ["typeParameters"],
2525
ObjectPattern: ["typeAnnotation"],
26-
RestElement: ["typeAnnotation"],
26+
/**
27+
* According to https://github.com/estree/estree/blob/master/extensions/type-annotations.md
28+
* RestElement should have "typeAnnotation", but has not. Annotation is added on the "parameter" node
29+
*/
30+
RestElement: [],
2731
TaggedTemplateExpression: ["typeParameters"],
2832
VariableDeclarator: ["typeParameters"],
2933

3034
TSAbstractClassProperty: ["typeAnnotation", "key", "value"],
35+
TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"],
3136
TSAbstractKeyword: [],
3237
TSAbstractMethodDefinition: ["key", "value"],
3338
TSAnyKeyword: [],
34-
TSArrayType: [],
39+
TSArrayType: ["elementType"],
3540
TSAsyncKeyword: [],
3641
TSBooleanKeyword: [],
37-
TSConstructorType: ["typeAnnotation"],
42+
TSConstructorType: ["typeAnnotation", "parameters"],
3843
TSConstructSignature: ["typeAnnotation", "typeParameters"],
3944
TSDeclareKeyword: [],
4045
TSEnumDeclaration: ["members"],
4146
TSEnumMember: ["initializer"],
4247
TSExportAssignment: ["expression"],
4348
TSExportKeyword: [],
4449
TSImportType: ["parameter", "qualifier", "typeParameters"],
45-
TSLiteralType: [],
50+
TSLiteralType: ["literal"],
4651
TSIndexSignature: ["typeAnnotation", "index"],
4752
TSInterfaceBody: ["body"],
4853
TSInterfaceDeclaration: ["body", "id", "heritage"],
@@ -52,7 +57,7 @@ module.exports = Evk.unionWith({
5257
TSModuleBlock: ["body"],
5358
TSModuleDeclaration: ["id", "body"],
5459
TSNamespaceFunctionDeclaration: [],
55-
TSNonNullExpression: [],
60+
TSNonNullExpression: ["expression"],
5661
TSNeverKeyword: [],
5762
TSNullKeyword: [],
5863
TSNumberKeyword: [],
@@ -69,14 +74,14 @@ module.exports = Evk.unionWith({
6974
TSStringKeyword: [],
7075
TSSymbolKeyword: [],
7176
TSTypeAnnotation: ["typeAnnotation"],
72-
TSTypeLiteral: [],
77+
TSTypeLiteral: ["members"],
7378
TSTypeOperator: ["typeAnnotation"],
7479
TSTypeParameter: ["constraint", "default"],
7580
TSTypeParameterDeclaration: ["params"],
7681
TSTypeParameterInstantiation: ["params"],
7782
TSTypePredicate: ["typeAnnotation", "parameterName"],
7883
TSTypeReference: ["typeName", "typeParameters"],
79-
TSUnionType: [],
84+
TSUnionType: ["types"],
8085
TSUndefinedKeyword: [],
8186
TSVoidKeyword: []
8287
});

0 commit comments

Comments
 (0)