-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Domain: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
The "extract to type alias" code fix is great, however, a lot of people (myself included) prefer interface
s for object types rather than type aliases.
Extract to interface should work only on an intersection type with some number of anonymous object types, named object types, and type references.
Examples
// before
let x: { hello: string, world: string };
// after
interface NewType {
hello: string;
world: string;
}
let x: NewType;
// before
let x: { hello: string, world: string } & Record<string, string>;
// after
interface NewType extends Record<string, string> {
hello: string;
world: string;
}
let x: NewType;
Related issues:
MrDesjardins, eamodio, felixfbecker, wmaurer, AnyhowStep and 10 moreBrunoScheufler
Metadata
Metadata
Assignees
Labels
Domain: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript