The following code compiles.
function myFunction(arg1:string, arg2:(msg:string)=>void){ /* do stuff */ }
var args = ["hello", function(msg){ /* do stuff */ }];
myFunction.apply(myFunction, args);
But the following code does not compile, even though the variable args is of the same type as above.
function myFunction(arg1:string, arg2:(msg:string)=>void){ /* do stuff */ }
var args = ["hello"].concat(function(msg){ /* do stuff */ });
myFunction.apply(myFunction, args);
It throws the following error.
>> src/workspace.ts(20,29): error TS2345: Argument of type '(msg: any) => void' is not assignable to parameter of type 'string'.
Any idea why? Is this a bug in my code or a bug in the TypeScript compiler?