1- import { useRef , useEffect , useMemo } from 'react' ;
1+ // @ts -nocheck
2+ import { useRef , useEffect , useMemo } from 'react' ;
23
34export interface CallOptions {
45 leading ?: boolean ;
@@ -87,12 +88,12 @@ export interface DebouncedState<T extends (...args: any[]) => ReturnType<T>>
8788 * const status = debounced.pending() ? "Pending..." : "Ready"
8889 */
8990export default function useDebouncedCallback <
90- T extends ( ...args : any [ ] ) => ReturnType < T > ,
91+ T extends ( ...args : any [ ] ) => ReturnType < T >
9192> ( func : T , wait ?: number , options ?: Options ) : DebouncedState < T > {
92- const lastCallTime = useRef ( null ) ;
93+ const lastCallTime = useRef < any > ( null ) ;
9394 const lastInvokeTime = useRef ( 0 ) ;
94- const timerId = useRef ( null ) ;
95- const lastArgs = useRef < unknown [ ] > ( [ ] ) ;
95+ const timerId = useRef < any > ( null ) ;
96+ const lastArgs = useRef < any > ( [ ] ) ;
9697 const lastThis = useRef < unknown > ( ) ;
9798 const result = useRef < ReturnType < T > > ( ) ;
9899 const funcRef = useRef ( func ) ;
@@ -107,13 +108,13 @@ export default function useDebouncedCallback<
107108 throw new TypeError ( 'Expected a function' ) ;
108109 }
109110
110- wait = + wait || 0 ;
111+ wait = + ( wait || 0 ) ;
111112 options = options || { } ;
112113
113114 const leading = ! ! options . leading ;
114115 const trailing = 'trailing' in options ? ! ! options . trailing : true ; // `true` by default
115116 const maxing = 'maxWait' in options ;
116- const maxWait = maxing ? Math . max ( + options . maxWait || 0 , wait ) : null ;
117+ const maxWait : any = maxing ? Math . max ( + options . maxWait || 0 , wait ) : null ;
117118
118119 useEffect ( ( ) => {
119120 mounted . current = true ;
0 commit comments