Nowadays it's really common to use object destruction for params (eg. React component props) and it's quite the default in a lot of cases. I keep finding myself in situations, where at the end I also need the props object as a whole, either for debugging purposes or passing forward. What happens next is that I move my destruction into the function body so I have both.
function Foo ({ x, y, y}) {}
// =>
function Foo (props) {
const { x, y, y} = props
}
It's just minor annoyance, but still, it'd be nice to be able to simplify this by using "named destruction", something like:
function Foo (props { x, y, z }) {
console.log(props, x, y, z)
}
Thanks! I tried to search before posting, but not exactly the naming I was searching for :) While I see these proposals solving my idea, I really don't like any of those syntaxes for this exact purpose.