Adding test and fix
This commit is contained in:
Родитель
7d3f387318
Коммит
6f12ed33f8
|
@ -176,7 +176,7 @@ function getNewFileImportsAndAddExportInOldFile(
|
|||
if (hasSyntacticModifier(decl, ModifierFlags.Default)) {
|
||||
oldFileDefault = name;
|
||||
}
|
||||
else {
|
||||
else if (!oldFileNamedImports.includes (name.text)) {
|
||||
oldFileNamedImports.push(name.text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @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.moveToNewFile({
|
||||
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";
|
||||
|
||||
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;
|
||||
}
|
||||
`
|
||||
},
|
||||
});
|
Загрузка…
Ссылка в новой задаче