From f6d2f7c32611acd0c4275223b07a457cf8449a9b Mon Sep 17 00:00:00 2001 From: James Chao Date: Fri, 27 Mar 2020 17:25:41 +0800 Subject: [PATCH] Directly use KeyHandler type from hotkeys-js --- src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 28d97fcd..9af4dc08 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,13 @@ -import hotkeys, { HotkeysEvent } from "hotkeys-js"; +import hotkeys, { KeyHandler } from "hotkeys-js"; import { useCallback, useEffect } from "react"; -type CallbackFn = (event: KeyboardEvent, handler: HotkeysEvent) => void; type Options = { filter?: typeof hotkeys.filter; }; export function useHotkeys( keys: string, - callback: CallbackFn, + callback: KeyHandler, deps: any[] = [], options: Options = {} ) {