I'm pretty sure that [...arguments].map(x => someFunc(x))
works fine in Javascript, but when I try it in Typescript I get the following error:
Type
IArguments
is not an array type or a string type. Use compiler option--downlevelIteration
to allow iterating of iterators.
Does anyone have a clue what is the issue here, and how can I resolve it without changing compiler configuration?
Update
I am able to solve it with Array.from(arguments).map(x => someFunc(x))
, but would still be happy to know why the spread operator (...
) is not working here.