type F = (...p: any[]) => any
function debounce(fn: F, t: number): F {
let timeout: ReturnType<typeof setTimeout>;
return function(...args) {
clearTimeout(timeout);
timeout = setTimeout(() => fn(...args), t); // так код работает
// timeout = setTimeout(fn, t, ...args); // error TS2322: Type 'number' is not assignable to type 'Timeout'.
}
};