Nightmarish Pawnshop Mystic

    @types/react-key-handler
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.0 • Public • Published

    Installation

    npm install --save @types/react-key-handler

    Summary

    This package contains type definitions for react-key-handler (https://github.com/ayrton/react-key-handler).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-key-handler.

    index.d.ts

    // Type definitions for react-key-handler 1.2
    // Project: https://github.com/ayrton/react-key-handler
    // Definitions by: Pedro Queiroz <https://github.com/pmqueiroz>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    import * as React from 'react';
    
    type _KEYDOWN = 'keydown';
    type _KEYPRESS = 'keypress';
    type _KEYUP = 'keyup';
    
    export type Matcher = (event: KeyboardEvent, ref: ReactKeyHandlerIntrinsicProps) => boolean;
    
    interface ReactKeyHandlerIntrinsicProps {
        /**
         * Any given [KeyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
         */
        keyValue?: string | string[];
    
        /**
         *  Any given [KeyboardEvent.keyCode](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode)
         *  @deprecated Deprecated in favour of `code`
         */
        keyCode?: number | number[];
    
        /**
         *  Any given [KeyboardEvent.code](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
         */
        code?: string | string[];
    
        /**
         *  Keyboard event type to listen to.
         *  @default 'keyup'
         */
        keyEventName?: _KEYDOWN | _KEYPRESS | _KEYUP;
    }
    
    export interface ReactKeyHandlerProps extends ReactKeyHandlerIntrinsicProps {
        /**
         * Callback that is called when they key is handled
         * @param event The event object
         */
        onKeyHandle: (event: React.KeyboardEvent) => void;
    }
    
    export default function KeyHandler(props: ReactKeyHandlerProps): JSX.Element;
    
    export function keyHandleDecorator(
        matcher?: Matcher,
    ): (props: ReactKeyHandlerProps) => (Component: JSX.Element) => (...args: any[]) => JSX.Element;
    
    export function keyToggleHandler(
        props: ReactKeyHandlerIntrinsicProps,
    ): (Component: JSX.Element) => (...args: any[]) => JSX.Element;
    
    export function keyHandler(
        props: ReactKeyHandlerIntrinsicProps,
    ): (Component: JSX.Element) => (...args: any[]) => JSX.Element;
    
    export const KEYDOWN: _KEYDOWN;
    
    export const KEYPRESS: _KEYPRESS;
    
    export const KEYUP: _KEYUP;
    
    // Shut off automatic exporting
    export {};

    Additional Details

    • Last updated: Fri, 08 Oct 2021 00:31:19 GMT
    • Dependencies: @types/react
    • Global values: none

    Credits

    These definitions were written by Pedro Queiroz.

    Keywords

    none

    Install

    npm i @types/react-key-handler

    DownloadsWeekly Downloads

    1,796

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    6.8 kB

    Total Files

    4

    Last publish

    Collaborators

    • types