4606709672
* add code fix convert to mapped object type * add support for type literal and improve test * fix typo * add support for heritageClauses * only determine declaration is not class
17 lines
338 B
TypeScript
17 lines
338 B
TypeScript
/// <reference path='fourslash.ts' />
|
|
|
|
//// type K = "foo" | "bar";
|
|
//// interface SomeType {
|
|
//// a: string;
|
|
//// [prop: K]: any;
|
|
//// }
|
|
|
|
verify.codeFix({
|
|
description: `Convert 'SomeType' to mapped object type`,
|
|
newFileContent: `type K = "foo" | "bar";
|
|
type SomeType = {
|
|
[prop in K]: any;
|
|
} & {
|
|
a: string;
|
|
};`
|
|
})
|