diff --git a/apps/scandic-web/utils/debounce.ts b/apps/scandic-web/utils/debounce.ts index 80eb13e96..6ada7d737 100644 --- a/apps/scandic-web/utils/debounce.ts +++ b/apps/scandic-web/utils/debounce.ts @@ -1,9 +1,11 @@ -export function debounce(func: Function, delay = 300) { +export function debounce( + func: (...args: Params) => any, + delay = 300 +) { let debounceTimer: ReturnType - return function () { - // @ts-expect-error this in TypeScript + + return function (this: U, ...args: Parameters) { const context = this - const args = arguments clearTimeout(debounceTimer) debounceTimer = setTimeout(() => func.apply(context, args), delay) }