When writing type for cb
:
const fn1 = (
cb: (...args: [...args: any[], fn2: () => string, fn3: () => string]) => any,
...args: any[]
) => {
const fn2 = () => 'fn2'
const fn3 = () => 'fn3'
cb(...args, fn2, fn3)
}
Run tsc
, an error is thrown:
A rest element must be last in a tuple type.