Closed

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.