@@ -325,7 +325,8 @@ namespace ts.refactor {
325
325
forEachTopLevelDeclaration ( statement , decl => {
326
326
movedSymbols . add ( Debug . assertDefined ( isExpressionStatement ( decl ) ? checker . getSymbolAtLocation ( decl . expression . left ) : decl . symbol ) ) ;
327
327
} ) ;
328
-
328
+ }
329
+ for ( const statement of toMove ) {
329
330
forEachReference ( statement , checker , symbol => {
330
331
if ( ! symbol . declarations ) return ;
331
332
for ( const decl of symbol . declarations ) {
@@ -460,7 +461,15 @@ namespace ts.refactor {
460
461
}
461
462
462
463
type TopLevelExpressionStatement = ExpressionStatement & { expression : BinaryExpression & { left : PropertyAccessExpression } } ; // 'exports.x = ...'
463
- type NonVariableTopLevelDeclaration = FunctionDeclaration | ClassDeclaration | EnumDeclaration | TypeAliasDeclaration | InterfaceDeclaration | ModuleDeclaration | TopLevelExpressionStatement ;
464
+ type NonVariableTopLevelDeclaration =
465
+ | FunctionDeclaration
466
+ | ClassDeclaration
467
+ | EnumDeclaration
468
+ | TypeAliasDeclaration
469
+ | InterfaceDeclaration
470
+ | ModuleDeclaration
471
+ | TopLevelExpressionStatement
472
+ | ImportEqualsDeclaration ;
464
473
type TopLevelDeclarationStatement = NonVariableTopLevelDeclaration | VariableStatement ;
465
474
interface TopLevelVariableDeclaration extends VariableDeclaration { parent : VariableDeclarationList & { parent : VariableStatement ; } ; }
466
475
type TopLevelDeclaration = NonVariableTopLevelDeclaration | TopLevelVariableDeclaration ;
@@ -481,6 +490,7 @@ namespace ts.refactor {
481
490
case SyntaxKind . EnumDeclaration :
482
491
case SyntaxKind . TypeAliasDeclaration :
483
492
case SyntaxKind . InterfaceDeclaration :
493
+ case SyntaxKind . ImportEqualsDeclaration :
484
494
return true ;
485
495
default :
486
496
return false ;
@@ -495,7 +505,8 @@ namespace ts.refactor {
495
505
case SyntaxKind . EnumDeclaration :
496
506
case SyntaxKind . TypeAliasDeclaration :
497
507
case SyntaxKind . InterfaceDeclaration :
498
- return cb ( statement as FunctionDeclaration | ClassDeclaration | EnumDeclaration | ModuleDeclaration | TypeAliasDeclaration | InterfaceDeclaration ) ;
508
+ case SyntaxKind . ImportEqualsDeclaration :
509
+ return cb ( statement as FunctionDeclaration | ClassDeclaration | EnumDeclaration | ModuleDeclaration | TypeAliasDeclaration | InterfaceDeclaration | ImportEqualsDeclaration ) ;
499
510
500
511
case SyntaxKind . VariableStatement :
501
512
return forEach ( ( statement as VariableStatement ) . declarationList . declarations as ReadonlyArray < TopLevelVariableDeclaration > , cb ) ;
@@ -557,6 +568,8 @@ namespace ts.refactor {
557
568
return updateTypeAliasDeclaration ( d , d . decorators , modifiers , d . name , d . typeParameters , d . type ) ;
558
569
case SyntaxKind . InterfaceDeclaration :
559
570
return updateInterfaceDeclaration ( d , d . decorators , modifiers , d . name , d . typeParameters , d . heritageClauses , d . members ) ;
571
+ case SyntaxKind . ImportEqualsDeclaration :
572
+ return updateImportEqualsDeclaration ( d , d . decorators , modifiers , d . name , d . moduleReference ) ;
560
573
case SyntaxKind . ExpressionStatement :
561
574
return Debug . fail ( ) ; // Shouldn't try to add 'export' keyword to `exports.x = ...`
562
575
default :
@@ -577,6 +590,7 @@ namespace ts.refactor {
577
590
case SyntaxKind . EnumDeclaration :
578
591
case SyntaxKind . TypeAliasDeclaration :
579
592
case SyntaxKind . InterfaceDeclaration :
593
+ case SyntaxKind . ImportEqualsDeclaration :
580
594
return undefined ;
581
595
case SyntaxKind . ExpressionStatement :
582
596
return Debug . fail ( ) ; // Shouldn't try to add 'export' keyword to `exports.x = ...`
0 commit comments