Ensure that the comma is removed when all named imports are removed via moveToFile - fixes #31195

This commit is contained in:
Orta Therox
2019-08-01 15:01:52 -04:00
parent b377e99958
commit c337f046fb
3 changed files with 33 additions and 2 deletions
+5 -1
View File
@@ -350,7 +350,11 @@ namespace ts.refactor {
}
if (namedBindings) {
if (namedBindingsUnused) {
changes.delete(sourceFile, namedBindings);
changes.replaceNode(
sourceFile,
importDecl.importClause,
updateImportClause(importDecl.importClause, name, /*namedBindings*/ undefined)
);
}
else if (namedBindings.kind === SyntaxKind.NamedImports) {
for (const element of namedBindings.elements) {