Incorrect inferred type for the async functions #156
TanStack Pacer version#
0.19.4
Framework/Library version#
React 18
Describe the bug and the steps to reproduce it#
Some async functions have incorrect inferred types.
const debouncedCallback = useAsyncDebouncedCallback(
async (value: string): Promise<string> => {
return "fake network result " + value
},
{
wait: 500,
}
)
// debouncedCallback: (value: string) => Promise<Promise<string>>
const throttledCallback = useAsyncThrottledCallback(
async (value: string): Promise<string> => {
return "fake network result " + value
},
{
wait: 500,
}
)
// throttledCallback: (value: string) => Promise<Promise<string>>
const rateLimitedCallback = useAsyncRateLimitedCallback(
async (value: string): Promise<string> => {
return "fake network result " + value
},
{
limit: 5,
window: 60000,
windowType: 'sliding',
}
)
// rateLimitedCallback: (value: string) => Promise<Promise<string>>
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)#
.
Screenshots or Videos (Optional)#
No response
Do you intend to try to help solve this bug with your own PR?#
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct#
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
KevinVandy closed this
Sign in to join this conversation.
Just tried to use the
useAsyncRateLimitedCallbackfn on react adapter 0.20.0 version and got the same problem. I'll use for now the standard version, but it'd be great to have it fixed!