Closed
Description
Destructuring still leaves much to be desired when it forces a lot of unnecessary repetition.
The best idea I saw is actually in the original issue for tracking destructuring:
#240
I feel that idea has mostly been overlooked and now forever sits in a closed issue, and that it deserves a second look.
@fdecampredon commented on Oct 20, 2014
For syntax of type annotations I would prefer the first option :
var {x: myX: number, y: myY: number} = myPoint(); // with renaming var {x:: number, y:: number} = myPoint(); // without renaming
than having over verbose syntax that force us to repeat the var names, especially for function arguments destructuring.
function myFunc({x::number, y::number }) { }
Seems a lot easier to read for me than :
function myFunc({x, y}: {x: number; y: number}) { }
I saw some related issues, but with not as good of syntax proposals. I include them for linking and reference:
#10079
#7576