diff --git a/src/useClickAway.ts b/src/useClickAway.ts index 23933b546f..dbe3860ff6 100644 --- a/src/useClickAway.ts +++ b/src/useClickAway.ts @@ -3,9 +3,9 @@ import { off, on } from './util'; const defaultEvents = ['mousedown', 'touchstart']; -const useClickAway = ( +const useClickAway = ( ref: RefObject, - onClickAway: (event: KeyboardEvent) => void, + onClickAway: (event: T | Event) => void, events: string[] = defaultEvents ) => { const savedCallback = useRef(onClickAway); diff --git a/stories/useClickAway.story.tsx b/stories/useClickAway.story.tsx index e5ab7d951c..f75d876824 100644 --- a/stories/useClickAway.story.tsx +++ b/stories/useClickAway.story.tsx @@ -7,7 +7,7 @@ import ShowDocs from './util/ShowDocs'; const Demo = () => { const ref = useRef(null); - useClickAway(ref, action('outside clicked')); + useClickAway(ref, action('outside clicked')); return (