Skip to content

"Move to file" does not carry all function overload and implementation signatures #54155

@DanielRosenwasser

Description

@DanielRosenwasser

"Move to file" doesn't seem to behave correctly for overloads

Given a function like

function add(x: number, y: number): number;
function add(x: string, y: string): string;
function add(x: any, y: any) {
    return x + y;
}

if you right click any of them and use this refactor, it will only move that part

Code_-_Insiders_pnskO6qwK9.mp4

Edit: I discovered it works correctly if you highlight all the functions and then use the refactor on the selection. But it would probably be better and more intuitive to properly handle overloads even if you don't? It works correctly for jsdoc at least, so I would expect it to also work for overloads

The old "Move to a new file" also seems affected by this

Originally posted by @Vendicated in #53542 (comment)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions