232ee608d5
- is contextually typed (because otherwise no type annotation for the variable would have been generated anyway) - is not generic - doesn't have parameters inferred as any If these conditions are met, we add missing parameters type and we add this parameter to the function.
15 lines
449 B
TypeScript
15 lines
449 B
TypeScript
/// <reference path='fourslash.ts' />
|
|
|
|
////declare function fnUnion(fn: <T>(a: T) => T): void
|
|
////fnUnion(/*a*/a => a/*b*/);
|
|
|
|
goTo.select("a", "b");
|
|
edit.applyRefactor({
|
|
refactorName: "Extract Symbol",
|
|
actionName: "constant_scope_0",
|
|
actionDescription: "Extract to constant in enclosing scope",
|
|
newContent:
|
|
`declare function fnUnion(fn: <T>(a: T) => T): void
|
|
const newLocal: <T>(a: T) => T = a => a;
|
|
fnUnion(/*RENAME*/newLocal);`
|
|
}); |