Skip to content

Suggestion: refactor to "move to another (existing) file" #29988

Closed
@OliverJAsh

Description

@OliverJAsh

Search Terms

Suggestion

The "move to new file" refactor is really helpful, but what if you want to move the code to an existing module?

This happens very often, when you realise code has been living in the wrong module, or it has a better home in some other module.

I would like to suggest a new refactor: "move to another (existing) file".

My workaround at the moment is to move the code manually, and then manually update all imports, but this is rather tedious!

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Labels

APIRelates to the public API for TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolDomain: TSServerIssues related to the TSServerFix AvailableA PR has been opened for this issueSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions