Fix removal of default import (#25200)

This commit is contained in:
Andy
2018-06-25 12:41:32 -07:00
committed by GitHub
parent f52c881ab1
commit 0b5b7ef547
2 changed files with 3 additions and 3 deletions

View File

@@ -148,7 +148,7 @@ namespace ts.refactor {
}
else if (namedBindings.kind === SyntaxKind.NamespaceImport) {
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
changes.deleteNode(importingSourceFile, ref);
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
const quotePreference = isStringLiteral(clause.parent.moduleSpecifier) ? quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : QuotePreference.Double;
const newImport = makeImport(/*default*/ undefined, [makeImportSpecifier(exportName, ref.text)], clause.parent.moduleSpecifier, quotePreference);
changes.insertNodeAfter(importingSourceFile, clause.parent, newImport);