Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0b5b7ef

Browse filesBrowse files
author
Andy
authored
Fix removal of default import (microsoft#25200)
1 parent f52c881 commit 0b5b7ef
Copy full SHA for 0b5b7ef

2 files changed

+3-3Lines changed: 3 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/refactors/convertExport.ts‎

Copy file name to clipboardExpand all lines: src/services/refactors/convertExport.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ namespace ts.refactor {
148148
}
149149
else if (namedBindings.kind === SyntaxKind.NamespaceImport) {
150150
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
151-
changes.deleteNode(importingSourceFile, ref);
151+
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
152152
const quotePreference = isStringLiteral(clause.parent.moduleSpecifier) ? quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : QuotePreference.Double;
153153
const newImport = makeImport(/*default*/ undefined, [makeImportSpecifier(exportName, ref.text)], clause.parent.moduleSpecifier, quotePreference);
154154
changes.insertNodeAfter(importingSourceFile, clause.parent, newImport);
Collapse file

‎tests/cases/fourslash/refactorConvertExport_defaultToNamed.ts‎

Copy file name to clipboardExpand all lines: tests/cases/fourslash/refactorConvertExport_defaultToNamed.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////import f from "./a";
88
////import { default as f } from "./a";
99
////import { default as g } from "./a";
10-
////import f, * as a from "./a"; // TODO: GH#24875
10+
////import f, * as a from "./a";
1111
////
1212
////export { default } from "./a";
1313
////export { default as f } from "./a";
@@ -29,7 +29,7 @@ edit.applyRefactor({
2929
`import { f } from "./a";
3030
import { f } from "./a";
3131
import { f as g } from "./a";
32-
import, * as a from "./a"; // TODO: GH#24875
32+
import * as a from "./a";
3333
import { f } from "./a";
3434
3535
export { f as default } from "./a";

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.