mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import {
|
|
isHotkey,
|
|
isCodeHotkey,
|
|
isKeyHotkey,
|
|
toKeyName,
|
|
toKeyCode,
|
|
parseHotkey,
|
|
compareHotkey
|
|
} from "is-hotkey";
|
|
|
|
const event = new KeyboardEvent("");
|
|
|
|
isHotkey("mod+s")(event); // $ExpectType boolean
|
|
isHotkey("mod+s", { byKey: true })(event); // $ExpectType boolean
|
|
|
|
isHotkey("mod+s", event); // $ExpectType boolean
|
|
isHotkey("mod+s", { byKey: true }, event); // $ExpectType boolean
|
|
|
|
isCodeHotkey("mod+s")(event); // $ExpectType boolean
|
|
isKeyHotkey("mod+s")(event); // $ExpectType boolean
|
|
|
|
isCodeHotkey("mod+s", event); // $ExpectType boolean
|
|
isKeyHotkey("mod+s", event); // $ExpectType boolean
|
|
|
|
toKeyName("cmd"); // $ExpectType string
|
|
|
|
toKeyCode("shift"); // $ExpectType number
|
|
|
|
parseHotkey("cmd+s"); // $ExpectType HotKey
|
|
parseHotkey("cmd+s", { byKey: true }); // $ExpectType HotKey
|
|
|
|
compareHotkey(parseHotkey("cmd+s"), event); // $ExpectType boolean
|
|
|
|
// Multiple hotkeys
|
|
|
|
isHotkey(["mod+s", "cmd+s"])(event); // $ExpectType boolean
|
|
|
|
isHotkey(["mod+s", "cmd+s"], event); // $ExpectType boolean
|
|
|
|
isCodeHotkey(["mod+s", "cmd+s"])(event); // $ExpectType boolean
|
|
|
|
isCodeHotkey(["mod+s", "cmd+s"], event); // $ExpectType boolean
|