mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
fix(54155): "Move to file" does not carry all function overload and implementation signatures (#54164)
This commit is contained in:
25
tests/cases/fourslash/moveToFile_overloads1.ts
Normal file
25
tests/cases/fourslash/moveToFile_overloads1.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////
|
||||
|
||||
// @Filename: /a.ts
|
||||
////[|function add(x: number, y: number): number;|]
|
||||
////function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" }
|
||||
});
|
||||
25
tests/cases/fourslash/moveToFile_overloads2.ts
Normal file
25
tests/cases/fourslash/moveToFile_overloads2.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////function add(x: string, y: string): string;
|
||||
////[|function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" }
|
||||
});
|
||||
25
tests/cases/fourslash/moveToFile_overloads3.ts
Normal file
25
tests/cases/fourslash/moveToFile_overloads3.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////[|function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" },
|
||||
});
|
||||
26
tests/cases/fourslash/moveToFile_overloads4.ts
Normal file
26
tests/cases/fourslash/moveToFile_overloads4.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////[|function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
////function remove() {}
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "function remove() {}",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" },
|
||||
});
|
||||
29
tests/cases/fourslash/moveToFile_overloads5.ts
Normal file
29
tests/cases/fourslash/moveToFile_overloads5.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /add.ts
|
||||
////
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////[|function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
////export const a = add();
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/a.ts":
|
||||
`import { add } from "./add";
|
||||
|
||||
export const a = add();`,
|
||||
"/add.ts":
|
||||
`export function add(x: number, y: number): number;
|
||||
export function add(x: string, y: string): string;
|
||||
export function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/add.ts" },
|
||||
});
|
||||
21
tests/cases/fourslash/moveToNewFile_overloads1.ts
Normal file
21
tests/cases/fourslash/moveToNewFile_overloads1.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////[|function add(x: number, y: number): number;|]
|
||||
////function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
});
|
||||
21
tests/cases/fourslash/moveToNewFile_overloads2.ts
Normal file
21
tests/cases/fourslash/moveToNewFile_overloads2.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////function add(x: string, y: string): string;
|
||||
////[|function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
});
|
||||
21
tests/cases/fourslash/moveToNewFile_overloads3.ts
Normal file
21
tests/cases/fourslash/moveToNewFile_overloads3.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////[|function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
});
|
||||
22
tests/cases/fourslash/moveToNewFile_overloads4.ts
Normal file
22
tests/cases/fourslash/moveToNewFile_overloads4.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////function add(x: number, y: number): number;
|
||||
////[|function add(x: string, y: string): string;
|
||||
////function add(x: any, y: any) {
|
||||
//// return x + y;
|
||||
////}|]
|
||||
////function remove() {}
|
||||
|
||||
verify.moveToNewFile({
|
||||
newFileContents: {
|
||||
"/a.ts": "function remove() {}",
|
||||
"/add.ts":
|
||||
`function add(x: number, y: number): number;
|
||||
function add(x: string, y: string): string;
|
||||
function add(x: any, y: any) {
|
||||
return x + y;
|
||||
}
|
||||
`
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user