File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 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 {
9393
9494 private visitBindingPatternIdentifiers ( pattern : ts . BindingPattern ) {
9595 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 ) ;
98103 }
99104 else {
100- this . visitBindingPatternIdentifiers ( element . name as ts . BindingPattern ) ;
105+ this . visitBindingPatternIdentifiers ( name as ts . BindingPattern ) ;
101106 }
102107 }
103108 }
@@ -191,7 +196,9 @@ class PreferConstWalker extends Lint.RuleWalker {
191196
192197 private collectBindingPatternIdentifiers ( value : ts . VariableDeclaration , pattern : ts . BindingPattern , table : ts . MapLike < DeclarationUsages > ) {
193198 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+ }
195202 }
196203 }
197204}
You can’t perform that action at this time.
0 commit comments