I need to call a varargs function:
function doSomething(... args): Object {
// do something with each arg
}
However, I'm building the arguments for this dynamically:
var someArgs: Array = ['a', 'b', 'c'];
doSomething(someArgs);
The problem is, when I call the function in this way args
ends up being a 1-element array with someArgs
as the first element, not a three-element array.
How can I call doSomething
with someArgs
as the argument array?
(For the search engines, this is argument unpacking)