From 5c95f285212d22f5e79217791f0626bd6e543836 Mon Sep 17 00:00:00 2001 From: streamich Date: Thu, 28 Mar 2019 19:01:23 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20TypeScript=20build?= =?UTF-8?q?=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/useEvent.ts | 4 ++-- src/useKeyPressEvent.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) 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;