npm.io
0.0.7 • Published 1 year ago

@types/redux-shortcuts

Licence
MIT
Version
0.0.7
Deps
2
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/redux-shortcuts

Summary

This package contains type definitions for redux-shortcuts (https://github.com/nak2k/node-redux-shortcuts).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-shortcuts.

index.d.ts

import { Action, ActionCreator, Dispatch } from "redux";
import Mousetrap = require("mousetrap");

export { Mousetrap };
export const mousetrap: Mousetrap.MousetrapInstance;

export function bindShortcut(
    keys: KeyBindings,
    actionCreator: ActionBindings,
    preventDefault?: boolean,
): (dispatch: Dispatch<any>) => void;

export function bindShortcuts(
    ...shortcut: ShortcutDefinition[]
): (dispatch: Dispatch<any>) => void;

export type KeyBindings = string | string[];

export type ActionBindings =
    | ActionCreator<Action>
    | Array<ActionCreator<Action>>;

export type ShortcutDefinition =
    | BasicShortcutDefinition
    | ShortcutDefinitionWithPreventDefault;

export type BasicShortcutDefinition = [KeyBindings, ActionBindings];

export type ShortcutDefinitionWithPreventDefault = [
    KeyBindings,
    ActionBindings,
    boolean,
];

Additional Details

Credits

These definitions were written by Tim Stirrat.