Similar fix for MoveToFile
This commit is contained in:
Родитель
6f12ed33f8
Коммит
067d2b9c94
|
@ -348,7 +348,7 @@ function getTargetFileImportsAndAddExportInOldFile(
|
|||
if (hasSyntacticModifier(decl, ModifierFlags.Default)) {
|
||||
oldFileDefault = name;
|
||||
}
|
||||
else {
|
||||
else if (!oldFileNamedImports.includes (name.text)) {
|
||||
oldFileNamedImports.push(name.text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////const x = 20;
|
||||
|
||||
// @Filename: /a.ts
|
||||
//// [|export function add(a: number, b: number): number;
|
||||
//// export function add(a: string, b: string): string;
|
||||
//// export function add(a: any, b: any): any {
|
||||
//// multiply(2,3);
|
||||
//// return a + b;
|
||||
//// }|]
|
||||
//
|
||||
//// function multiply(x: number, y: number): number;
|
||||
//// function multiply(x: string, y: string): string;
|
||||
//// function multiply(x: any, y: any) {
|
||||
//// return x + y;
|
||||
//// }
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts":
|
||||
`export function multiply(x: number, y: number): number;
|
||||
export function multiply(x: string, y: string): string;
|
||||
export function multiply(x: any, y: any) {
|
||||
return x + y;
|
||||
}`,
|
||||
|
||||
"/add.ts":
|
||||
`import { multiply } from "./a";
|
||||
|
||||
const x = 20;
|
||||
export function add(a: number, b: number): number;
|
||||
export function add(a: string, b: string): string;
|
||||
export function add(a: any, b: any): any {
|
||||
multiply(2, 3);
|
||||
return a + b;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" },
|
||||
});
|
Загрузка…
Ссылка в новой задаче