export type KeyPressProps = { /** * A key, list of keys, or list of key combinations that should be listened to. * e.g. "ENTER", ["ENTER", "TAB"], [["SHIFT", "ENTER"], "TAB"] */ targetKeys: KeyboardEvent["key"] | Array; /** * If true, key events will be listened to from the window. * If false, you need to manually call upHandler and downHandler and have more control over event handling. */ listenToWindow?: boolean; }; export default function useKeyPress({ targetKeys, listenToWindow, }: KeyPressProps): { keyPressed: boolean; upHandler: ({ key }: { key: string; }) => boolean; downHandler: ({ key }: { key: string; }) => boolean; };