2019-05-07 17:26:54 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
2019-06-06 19:28:42 +02:00
|
|
|
//// type Item<T> = /*a*/T extends (infer P)[] ? P : never/*b*/;
|
2019-05-07 17:26:54 +02:00
|
|
|
|
|
|
|
goTo.select("a", "b");
|
|
|
|
edit.applyRefactor({
|
|
|
|
refactorName: "Extract type",
|
|
|
|
actionName: "Extract to type alias",
|
|
|
|
actionDescription: "Extract to type alias",
|
|
|
|
newContent: `type /*RENAME*/NewType<T> = T extends (infer P)[] ? P : never;
|
|
|
|
|
2019-06-06 19:28:42 +02:00
|
|
|
type Item<T> = NewType<T>;`,
|
2019-05-07 17:26:54 +02:00
|
|
|
});
|