ARTICLE AD BOX
When creating debouncing function using setTimeout , this error with squiggle line saying that number is assignable to type Timeout.
Function Code Snippet :
export const debounce = <T extends (...args : any[]) => any> ( func : T , wait : number ) : ((...args : Parameters<T>) => void) => { let timeout : NodeJS.Timeout; return (...args : Parameters<T>) => { // casting the variable to number clearTimeout(Number(timeout)); timeout = setTimeout(() => func(...args) , wait); }; };