Closed
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: