Note: The code is using spread syntax
, not rest parameters
.
const fn1 = undefined
const args = []
const fn2 = () => {}
const fn3 = () => {}
console.log(fn1?.(...args, fn2, fn3))
Error:
console.log(fn1?.(...args, fn2, fn3))
^
TypeError: Function.prototype.apply was called on undefined, which is an undefined and not a function
It turns out to be a V8 bug, I've submitted it there, hopefully, it'll be fixed soon.
Update: it has been fixed.