Typescript debounce function not calling function passed as parameter
问题 I'm trying to write a debounce function with typescript . I found an example of it in here. Code follows: export function debounce<Params extends any[]>( func: (...args: Params) => any, timeout: number, ): (...args: Params) => void { let timer: NodeJS.Timeout return (...args: Params) => { clearTimeout(timer) timer = setTimeout(() => { func(...args) }, timeout) } } Problem is: Function passed as a parameter is not getting called after the specified timeout I can't use lodash or any other