diff --git a/src/useEvent.ts b/src/useEvent.ts index ce7d13a8a3..3bd51b4e34 100644 --- a/src/useEvent.ts +++ b/src/useEvent.ts @@ -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)]); diff --git a/src/useKeyPressEvent.ts b/src/useKeyPressEvent.ts index 44d0169228..2e11ab4781 100644 --- a/src/useKeyPressEvent.ts +++ b/src/useKeyPressEvent.ts @@ -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;