Skip to content

Commit

Permalink
fix: πŸ› fix TypeScript build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 28, 2019
1 parent 3516aa6 commit 5c95f28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/useEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const useEvent = (name: string, handler?: null | undefined | ((event?: any) => v
useEffect(() => {
if (!handler) return;
if (!target) return;
const fn = ((target as ListenerType1).addEventListener || (target as ListenerType2).on);
const fn: any = ((target as ListenerType1).addEventListener || (target as ListenerType2).on);
fn.call(target, name, handler, options);
return () => {
const fn = ((target as ListenerType1).removeEventListener || (target as ListenerType2).off);
const fn: any = ((target as ListenerType1).removeEventListener || (target as ListenerType2).off);
fn.call(target, name, handler, options);
};
}, [name, handler, target, JSON.stringify(options)]);
Expand Down
4 changes: 1 addition & 3 deletions src/useKeyPressEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const useKeyPressEvent = (
onKeydown: KeyPressCallback = undefined
) => {
const useKeyboardJS: boolean = targetKey.length > 1;
const pressedKeys: boolean = useKeyPress(targetKey, {
useKeyboardJS,
});
const pressedKeys: boolean = useKeyPress(targetKey);

if (onKeydown === undefined) {
onKeydown = onKeyup;
Expand Down

0 comments on commit 5c95f28

Please sign in to comment.