Description
Hello,
when doing some prototyping and playing with object destructuring in function argument I've noticed that I must duplicate identifier names in type information and if there are many variables it looks heavier:
function mainLayoutComponent({banners, profile, cart}: { banners: Component, profile: Component, cart: Component }): any { }
Proposal:
My suggestion would be that destructuring in function argument position would allow type information definition if object type is not explicitly defined:
function mainLayoutComponent({banners: Component, profile: Component, cart: Component}): any { }
It would be handy. I don't know how that sounds from language design perspective as it feels like it will be possible to define a function which argument identifier is "unknown" but with given type information.
Compiler could translate that kind of construct into destructuring syntax before compilation.
Note: I've seen propsal with ::
operator (#13471) which was rejected, but this "special treatment" of destructuring in argument space looks ES6, ES7 compatible.