Both
function x(o) {
return o.a + o.b
}
and
function x({ a, b }) {
return a + b
}
are possible. What about something like this?
function x(o | { a, b }) {
console.log('Whole thing:', o)
return a + b
}
Both
function x(o) {
return o.a + o.b
}
and
function x({ a, b }) {
return a + b
}
are possible. What about something like this?
function x(o | { a, b }) {
console.log('Whole thing:', o)
return a + b
}
You could move the destructuring part inside of the function.
function x(o) {
const { a, b } = o;
console.log('Whole thing:', o)
return a + b;
}