functionfoo({ x, y ={}}={x: 0,y: {}}){}foo();// Finefoo({x: 0,y: 0});// Finefoo({x: 0});// ErrorThe last line should not be an error because the y property has a default initializer. The error goes away if I remove the default initializer { x: 0, y: {}} on the parent.
I think the rule would be that even if we get the type of a parameter / variable / binding element from an initializer, we still have to traverse the binding pattern to determine whether binding properties are optional.
The last line should not be an error because the y property has a default initializer. The error goes away if I remove the default initializer
{ x: 0, y: {}}on the parent.I think the rule would be that even if we get the type of a parameter / variable / binding element from an initializer, we still have to traverse the binding pattern to determine whether binding properties are optional.