-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.1.0-dev.20180721
Code
function f() { return { x: 0, y: 1, z: 2 }; }
const p = f();
p.x;
p.y;
p.z;Expected behavior:
After:
function f() { return { x: 0, y: 1, z: 2 }; }
const { x, y, z } = f();
x;
y;
z;Note: I think it should generate { x, y, z } even if they're not all currently used (meaning, it should use every property declared in the return type of f). That way it's useful to perform this refactor immediately after writing the call to f(), before the result has been used.
Actual behavior:
No such refactor.
DanielRosenwasser and OliverJAsh
Metadata
Metadata
Assignees
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolSuggestionAn idea for TypeScriptAn idea for TypeScript