mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Component commits:
4baff1b241 moveToNewFile: handle namespace imports too
Fixes #35591
Co-authored-by: Eli Barzilay <eli@barzilay.org>
This commit is contained in:
co-authored by
Eli Barzilay
parent
d906a471dd
commit
ef028bcd08
@@ -533,6 +533,7 @@ namespace ts.refactor {
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
return true;
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return isVariableDeclarationInImport(decl as VariableDeclaration);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import { foo as oFoo } from './other';
|
||||
////[|export const x = oFoo();|]
|
||||
////export const a = 0;
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts":
|
||||
`export const a = 0;`,
|
||||
|
||||
"/x.ts":
|
||||
`import { foo as oFoo } from './other';
|
||||
export const x = oFoo();
|
||||
`
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import * as o from './other';
|
||||
////[|export const x = o.foo();|]
|
||||
////export const a = 0;
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts":
|
||||
`export const a = 0;`,
|
||||
|
||||
"/x.ts":
|
||||
`import * as o from './other';
|
||||
export const x = o.foo();
|
||||
`
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user