EssentialTypeScriptBook
EssentialTypeScriptBook copied to clipboard
area for clarification - Spread Operator
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.