It looks like the typing for useTimeout is wrong and should return an array literal instead. This way it gets proper type inference when destructuring the array.
Here is the diff that solved my problem:
diff --git a/node_modules/beautiful-react-hooks/useTimeout.d.ts b/node_modules/beautiful-react-hooks/useTimeout.d.ts
index 383d9b6..ecaa671 100644
--- a/node_modules/beautiful-react-hooks/useTimeout.d.ts
+++ b/node_modules/beautiful-react-hooks/useTimeout.d.ts
@@ -6,5 +6,5 @@ export declare type UseTimeoutOptions = {
* An async-utility hook that accepts a callback function and a delay time (in milliseconds), then delays the
* execution of the given function by the defined time.
*/
-declare const useTimeout: <TCallback extends GenericFunction>(fn: TCallback, milliseconds: number, options?: UseTimeoutOptions) => (boolean | (() => void))[];
+declare const useTimeout: <TCallback extends GenericFunction>(fn: TCallback, milliseconds: number, options?: UseTimeoutOptions) => [boolean, () => void];
export default useTimeout;
It looks like the typing for
useTimeout
is wrong and should return an array literal instead. This way it gets proper type inference when destructuring the array.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.