@@ -580,13 +580,13 @@ export class Converter {
580
580
if ( ! modifiers || ! modifiers . length ) {
581
581
return ;
582
582
}
583
+ const remainingModifiers : TSESTree . Modifier [ ] = [ ] ;
583
584
/**
584
585
* Some modifiers are explicitly handled by applying them as
585
586
* boolean values on the result node. As well as adding them
586
587
* to the result, we remove them from the array, so that they
587
588
* are not handled twice.
588
589
*/
589
- const handledModifierIndices : { [ key : number ] : boolean } = { } ;
590
590
for ( let i = 0 ; i < modifiers . length ; i ++ ) {
591
591
const modifier = modifiers [ i ] ;
592
592
switch ( modifier . kind ) {
@@ -596,31 +596,26 @@ export class Converter {
596
596
*/
597
597
case SyntaxKind . ExportKeyword :
598
598
case SyntaxKind . DefaultKeyword :
599
- handledModifierIndices [ i ] = true ;
600
599
break ;
601
600
case SyntaxKind . ConstKeyword :
602
601
( result as any ) . const = true ;
603
- handledModifierIndices [ i ] = true ;
604
602
break ;
605
603
case SyntaxKind . DeclareKeyword :
606
604
result . declare = true ;
607
- handledModifierIndices [ i ] = true ;
608
605
break ;
609
606
default :
607
+ remainingModifiers . push ( this . convertChild ( modifier ) ) ;
608
+ break ;
610
609
}
611
610
}
612
611
/**
613
612
* If there are still valid modifiers available which have
614
613
* not been explicitly handled above, we just convert and
615
614
* add the modifiers array to the result node.
616
615
*/
617
- const remainingModifiers = modifiers . filter (
618
- ( _ , i ) => ! handledModifierIndices [ i ] ,
619
- ) ;
620
- if ( ! remainingModifiers || ! remainingModifiers . length ) {
621
- return ;
616
+ if ( remainingModifiers . length ) {
617
+ result . modifiers = remainingModifiers ;
622
618
}
623
- result . modifiers = remainingModifiers . map ( el => this . convertChild ( el ) ) ;
624
619
}
625
620
626
621
/**
0 commit comments