es-toolkit icon indicating copy to clipboard operation
es-toolkit copied to clipboard

Debounce async functions

Open throrin19 opened this issue 10 months ago • 0 comments

Hello,

It is possible to debounce an async function and return the result ? Actually If I test like that TS said the debounced function is not async :

// just a silly example, normally the debounced function return request result
const requestAction = debounce(
    async () => 1,
    1000,
);

const result = await requestAction(); // TS said requestAction is not async

throrin19 avatar Dec 13 '24 07:12 throrin19