mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-07 17:29:36 -05:00
Fix removal of default import (#25200)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
////import f from "./a";
|
||||
////import { default as f } from "./a";
|
||||
////import { default as g } from "./a";
|
||||
////import f, * as a from "./a"; // TODO: GH#24875
|
||||
////import f, * as a from "./a";
|
||||
////
|
||||
////export { default } from "./a";
|
||||
////export { default as f } from "./a";
|
||||
@@ -29,7 +29,7 @@ edit.applyRefactor({
|
||||
`import { f } from "./a";
|
||||
import { f } from "./a";
|
||||
import { f as g } from "./a";
|
||||
import, * as a from "./a"; // TODO: GH#24875
|
||||
import * as a from "./a";
|
||||
import { f } from "./a";
|
||||
|
||||
export { f as default } from "./a";
|
||||
|
||||
Reference in New Issue
Block a user