ts-debounce
ts-debounce copied to clipboard
Use Awaited type to avoid Promise<Promise<T>>
When debouncing a Promise-returning function, the returned function has a type of Promise<Promise<T>> which is not accurate - see https://github.com/microsoft/TypeScript/issues/27711
In TypeScript 4.5, a new Awaited<T> type was introduced to solve this problem.
This PR simply wraps the ReturnType<F> with Awaited<...> in order to get an accurate return type for the created function.
Several packages were updated:
- Typescript bumped to 4.5 in order to access this type
- microbundle in order to build
- jest / ts-jest in order to test with this type
- tsd in order to validate the types