Fix: index.d.ts exports custom object. #38

pull/45/head
jaywcjlove 7 years ago
parent 3dbe743357
commit cbccf516b9

27
index.d.ts vendored

@ -1,8 +1,4 @@
// Type definitions for hotkeys v3.3.3 export interface HotkeysEvent {
// Project: https://github.com/jaywcjlove/hotkeys
// Definitions by: Eager Wei <https://github.com/weidapao>
interface HotkeysEvent {
key: string key: string
method: KeyHandler method: KeyHandler
mods: number[] mods: number[]
@ -10,11 +6,11 @@ interface HotkeysEvent {
shortcut: string shortcut: string
} }
interface KeyHandler { export interface KeyHandler {
(keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent): void (keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent): void
} }
interface FilterEvent { export interface FilterEvent {
target?: { target?: {
tagName?: string tagName?: string
} }
@ -23,9 +19,15 @@ interface FilterEvent {
} }
} }
type Options = {
scope: string,
element?: HTMLElement | null
}
interface Hotkeys { interface Hotkeys {
(key: string, callback: KeyHandler): void (key: string, callback: Function): void
(key: string, scope: string, callback: KeyHandler): void (key: string, scope: string, callback?: KeyHandler): void
(key: string, scope: Options, callback?: KeyHandler): void
shift: boolean shift: boolean
ctrl: boolean ctrl: boolean
@ -50,9 +52,6 @@ interface Hotkeys {
filter(event: FilterEvent): boolean filter(event: FilterEvent): boolean
} }
// https://github.com/eiriklv/react-masonry-component/issues/57
declare var hotkeys: Hotkeys declare var hotkeys: Hotkeys
export default hotkeys;
declare module 'hotkeys-js' {
export = hotkeys
}

Loading…
Cancel
Save