的任何签字所以我有这样的功能:打字稿提供的参数不匹配,调用对象的
function foo(a, b, c, d, e) {
// something creative
}
当我这样称呼它:
foo(1, 2, 3, 4, 5);
它工作正常。
...但是,当我这样称呼它:
const lastTwo = [4, 5];
foo(1, 2, 3, ...lastTwo);
打字稿尖叫说:
error TS2346: Supplied parameters do not match any signature of call target.
我如何克服呢?