Looking at this simple code from MDN :
function myFunction(x, y, z):void { }
var args = [0, 1, 2];
myFunction(...args);
— I get an error :
Even If I'm being super clear :
function myFunction(x, y, z):void { }
var args:any[3] = [0, 1, 2];
myFunction(...args:any[3]);
It still doesn't work.
Question:
Why doesn't it work and did I miss something ?
I've already seen this answer which muted the error via :
function myFunction(x, y, z):void { }
var args = [0, 1, 2];
(<any>myFunction)(...args);
Why did <any>
mute the error ?
It would've been clear if it was :
(<any>)(myFunction(...args));
but it's not.