【发布时间】:2015-06-09 22:43:21
【问题描述】:
为什么这段代码不与flow 一起打字?
function runFunction<I, O>( fun: (...args:Array<I>) => O, args:Array<I> ): O {
var res = fun.apply(null, args);
return res;
}
function myFun(first: number, second: number): string {
return first + ", " + second;
}
runFunction(myFun, [1, 2]);
我认为我做的一切都是正确的,我仍然得到这个
function type
Too few arguments (expected default/rest parameters in function)
function
rest array of type parameter I of function call
This type is incompatible with
number
【问题讨论】:
标签: javascript flowtype