Skip to content

Commit

Permalink
fix: restrict useThrottleFn types
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich authored Nov 11, 2019
2 parents 545f88e + 664b071 commit 61a83d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useThrottleFn.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import useUnmount from './useUnmount';

const useThrottleFn = <T>(fn: (...args: any[]) => T, ms: number = 200, args: any[]) => {
const useThrottleFn = <T, U extends any[]>(fn: (...args: U) => T, ms: number = 200, args: U) => {
const [state, setState] = useState<T>(null as any);
const timeout = useRef<ReturnType<typeof setTimeout>>();
const nextArgs = useRef(null) as any;
Expand Down

0 comments on commit 61a83d1

Please sign in to comment.