File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,16 @@ class PreferConstWalker extends Lint.RuleWalker {
93
93
94
94
private visitBindingPatternIdentifiers ( pattern : ts . BindingPattern ) {
95
95
for ( const element of pattern . elements ) {
96
- if ( element . name . kind === ts . SyntaxKind . Identifier ) {
97
- this . markAssignment ( element . name as ts . Identifier ) ;
96
+ if ( element . kind !== ts . SyntaxKind . BindingElement ) {
97
+ continue ;
98
+ }
99
+
100
+ const name = ( < ts . BindingElement > element ) . name ;
101
+ if ( name . kind === ts . SyntaxKind . Identifier ) {
102
+ this . markAssignment ( name as ts . Identifier ) ;
98
103
}
99
104
else {
100
- this . visitBindingPatternIdentifiers ( element . name as ts . BindingPattern ) ;
105
+ this . visitBindingPatternIdentifiers ( name as ts . BindingPattern ) ;
101
106
}
102
107
}
103
108
}
@@ -191,7 +196,9 @@ class PreferConstWalker extends Lint.RuleWalker {
191
196
192
197
private collectBindingPatternIdentifiers ( value : ts . VariableDeclaration , pattern : ts . BindingPattern , table : ts . MapLike < DeclarationUsages > ) {
193
198
for ( const element of pattern . elements ) {
194
- this . collectNameIdentifiers ( value , element . name , table ) ;
199
+ if ( element . kind === ts . SyntaxKind . BindingElement ) {
200
+ this . collectNameIdentifiers ( value , ( < ts . BindingElement > element ) . name , table ) ;
201
+ }
195
202
}
196
203
}
197
204
}
You can’t perform that action at this time.
0 commit comments