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

Commit c2c25cc

Browse files
committed
Fix: Allow to visit typeParameters in VariableDeclarator
1 parent 0c6c452 commit c2c25cc

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ npm-debug.log
55
_test.js
66
.DS_Store
77
.vscode
8+
89
yarn.lock
910
.eslint-release-info.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type foo<A> = Foo<A>

tests/lib/__snapshots__/scope-analysis.js.snap

+25
Original file line numberDiff line numberDiff line change
@@ -5690,6 +5690,31 @@ Object {
56905690
}
56915691
`;
56925692

5693+
exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-generic.ts 1`] = `
5694+
Object {
5695+
"$id": 0,
5696+
"block": Object {
5697+
"range": Array [
5698+
0,
5699+
22,
5700+
],
5701+
"type": "Program",
5702+
},
5703+
"childScopes": Array [],
5704+
"functionExpressionScope": false,
5705+
"isStrict": false,
5706+
"references": Array [],
5707+
"throughReferences": Array [],
5708+
"type": "global",
5709+
"upperScope": null,
5710+
"variableMap": Object {},
5711+
"variableScope": Object {
5712+
"$ref": 0,
5713+
},
5714+
"variables": Array [],
5715+
}
5716+
`;
5717+
56935718
exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = `
56945719
Object {
56955720
"$id": 3,

visitor-keys.js

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module.exports = Evk.unionWith({
2121
ObjectPattern: ["properties", "typeAnnotation"],
2222
NewExpression: ["callee", "typeParameters", "arguments"],
2323
CallExpression: ["callee", "typeParameters", "arguments"],
24+
// typeParameters are preset only when kind='type'
25+
VariableDeclarator: ["id", "typeParameters", "init"],
2426

2527
// Additional Nodes.
2628
ClassProperty: ["decorators", "key", "typeAnnotation", "value"],

0 commit comments

Comments
 (0)