Skip to content

Commit

Permalink
fix: double reporting function argument type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed May 18, 2020
1 parent 26e6edf commit 3c94b99
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 27 deletions.
3 changes: 2 additions & 1 deletion packages/scope-manager/src/referencer/Referencer.ts
Expand Up @@ -214,13 +214,14 @@ class Referencer extends Visitor {
new ParameterDefinition(pattern, node, info.rest),
);

this.visitType(pattern.typeAnnotation);
this.referencingDefaultValue(pattern, info.assignments, null, true);
},
{ processRightHandNodes: true },
);
if ('typeAnnotation' in param) {
this.visitType(param.typeAnnotation);
} else if (param.type === AST_NODE_TYPES.AssignmentPattern) {
this.visitType(param.left.typeAnnotation);
}
param.decorators?.forEach(d => this.visit(d));
}
Expand Down
Expand Up @@ -49,11 +49,6 @@ ScopeManager {
isTypeReference: true,
resolved: Variable$3,
},
Reference$3 {
identifier: Identifier<"T">,
isTypeReference: true,
resolved: Variable$3,
},
],
isValueVariable: false,
isTypeVariable: true,
Expand All @@ -80,7 +75,6 @@ ScopeManager {
isStrict: false,
references: Array [
Reference$2,
Reference$3,
],
set: Map {
"a" => Variable$2,
Expand Down
Expand Up @@ -48,11 +48,6 @@ ScopeManager {
isTypeReference: true,
resolved: Variable$4,
},
Reference$2 {
identifier: Identifier<"T">,
isTypeReference: true,
resolved: Variable$4,
},
],
isValueVariable: false,
isTypeVariable: true,
Expand All @@ -77,7 +72,6 @@ ScopeManager {
isStrict: false,
references: Array [
Reference$1,
Reference$2,
],
set: Map {
"arguments" => Variable$2,
Expand Down
Expand Up @@ -56,11 +56,6 @@ ScopeManager {
isTypeReference: true,
resolved: Variable$4,
},
Reference$3 {
identifier: Identifier<"T">,
isTypeReference: true,
resolved: Variable$4,
},
],
isValueVariable: false,
isTypeVariable: true,
Expand All @@ -87,7 +82,6 @@ ScopeManager {
isStrict: false,
references: Array [
Reference$2,
Reference$3,
],
set: Map {
"arguments" => Variable$2,
Expand Down
Expand Up @@ -12,7 +12,7 @@ ScopeManager {
],
name: "T",
references: Array [
Reference$1 {
Reference$2 {
identifier: Identifier<"T">,
isTypeReference: true,
resolved: Variable$1,
Expand Down Expand Up @@ -49,7 +49,7 @@ ScopeManager {
],
name: "a",
references: Array [
Reference$2 {
Reference$1 {
identifier: Identifier<"a">,
init: true,
isTypeReference: false,
Expand Down
Expand Up @@ -17,11 +17,6 @@ ScopeManager {
isTypeReference: true,
resolved: Variable$1,
},
Reference$2 {
identifier: Identifier<"T">,
isTypeReference: true,
resolved: Variable$1,
},
],
isValueVariable: false,
isTypeVariable: true,
Expand Down Expand Up @@ -79,7 +74,6 @@ ScopeManager {
isStrict: false,
references: Array [
Reference$1,
Reference$2,
],
set: Map {
"arguments" => Variable$3,
Expand Down

0 comments on commit 3c94b99

Please sign in to comment.