Skip to content

Commit

Permalink
fix: πŸ› support default event in useClickAway()
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 15, 2020
1 parent d0830b6 commit 24281cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/useClickAway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { off, on } from './util';

const defaultEvents = ['mousedown', 'touchstart'];

const useClickAway = <T extends Event>(
const useClickAway = <E extends Event = Event>(
ref: RefObject<HTMLElement | null>,
onClickAway: (event: T | Event) => void,
onClickAway: (event: E) => void,
events: string[] = defaultEvents
) => {
const savedCallback = useRef(onClickAway);
Expand Down

0 comments on commit 24281cd

Please sign in to comment.