的任何簽字所以我有這樣的功能:打字稿提供的參數不匹配,調用對象的
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.
我如何克服呢?