EssentialTypeScriptBook icon indicating copy to clipboard operation
EssentialTypeScriptBook copied to clipboard

area for clarification - Spread Operator

Open robin-raymond opened this issue 9 years ago • 0 comments

list.push(...toAdd);

I totally get why the ... is needed in the other examples for their sugar to work, but this one baffled me. I'm sure there are "reasons" but I find it strange why a list would need to use the ... to indicate a push of multiple entries to a function like push. This small bit could be clarified. You would think strong typing would implicitly make it understood given the context. Maybe I'm not understanding properly.

robin-raymond avatar Jun 11 '16 02:06 robin-raymond