mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
moveToNewFile: Fix bug for missing importClause (#24224)
This commit is contained in:
@@ -440,6 +440,7 @@ namespace ts.refactor {
|
||||
switch (i.kind) {
|
||||
case SyntaxKind.ImportDeclaration: {
|
||||
const clause = i.importClause;
|
||||
if (!clause) return undefined;
|
||||
const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined;
|
||||
const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep);
|
||||
return defaultImport || namedBindings
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import "./foo";
|
||||
////import { a, b, alreadyUnused } from "./other";
|
||||
////const p = 0;
|
||||
////[|const y = p + b;|]
|
||||
@@ -11,6 +12,7 @@ verify.moveToNewFile({
|
||||
"/a.ts":
|
||||
`import { y } from "./y";
|
||||
|
||||
import "./foo";
|
||||
import { a, alreadyUnused } from "./other";
|
||||
export const p = 0;
|
||||
a; y;`,
|
||||
|
||||
Reference in New Issue
Block a user