[...arguments] should not compile to return [].concat(arguments)
Because Array#concat
will recognize arguments
object as a plain object instead of an array.
This issue is also reproducible with other array-like objects, such as NodeList
.
How other transpilers handle this:
Babel:
[].concat(Array.prototype.slice.call(arguments));
TypeScript:
arguments.slice()
// Error: (1/1) Type 'IArguments' is not an array type.
Traceur:
$traceurRuntime.spread(arguments);