You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Object rest destructuring parameter defaults to empty object, causing errors when untyped #12519
However, the above is in error, as the type inferred for ...others is the empty object ({}). Thus the expression within the DIV tags gives the error Property 'anything' does not exist on type '{}'.
If I explicitly type the parameter then all is OK. Namely:
It seems to me that for the ease of writing (and porting existing code), ...others above should default to any, as other untyped parameters do.
This may have already been discussed in some of the other rest/spread discussions. I did trying to find a definitive explanation, but those threads were quite verbose. Apologies if already covered.
That's an oversight I think. The machinery that infers a contextual type for binding patterns needs to be updated for object rest so that it propagates the any through to `others`.
Activity
sandersn commentedon Nov 27, 2016