Closed
Description
This typechecks:
function f({a = 1, b = 2}) {
}
f({});
But this does not:
function f({a = 1, b = 2} = {}) {
}
f();
with an error Type '{}' has no property 'a' and no string index
.
I'd expect both to behave the same way.
This idiom is pretty convenient in ES6-style code and I don't see why a passed parameter would be treated differently from a default value here.