Suggested refactoring: move function/type/class to new file #13859
Labels
Domain: Refactorings
e.g. extract to constant or function, rename symbol
Fixed
A PR has been merged for this issue
Suggestion
An idea for TypeScript
Milestone
I suggest adding a refactoring/code fix that helps with the task of moving a class/function/type or other top level declaration out of the current file and into another file, updating references as needed.
Motivation
Often when starting out with a new feature it makes sense to start to write code in a single file while working out the design. However, as soon as long method bodies start getting implemented or when code gets checked in to version control, it makes less sense and gets harder to work with and you want to move top level members into separate files.
I've found CodeRush and ReSharper's "Move Type to File" tool (for VS/C#) very useful in this workflow and I miss it greatly when working with TypeScript/VS Code.
Example
before:
after invoking "Move declaration to file" on MyListItem:
Design
.tsx
extension as appropriate, either based on the file it is invoked in or the contents of the code transferred.Edit: removed parenthesis after class names
The text was updated successfully, but these errors were encountered: