currentTarget - a reference to the element on which the event listener is registered.

target - a reference to the element from which the event was originally dispatched. This might be a child element to the element on which the event listener is registered. If you thought this should be EventTarget & T, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682

interface KeyboardEvent<T> {
    altKey: boolean;
    bubbles: boolean;
    cancelable: boolean;
    charCode: number;
    ctrlKey: boolean;
    currentTarget: EventTarget & T;
    defaultPrevented: boolean;
    eventPhase: number;
    isTrusted: boolean;
    key: string;
    keyCode: number;
    locale: string;
    location: number;
    metaKey: boolean;
    nativeEvent: KeyboardEvent;
    repeat: boolean;
    shiftKey: boolean;
    target: EventTarget;
    timeStamp: number;
    type: string;
    which: number;
    getModifierState(key: string): boolean;
    isDefaultPrevented(): boolean;
    isPropagationStopped(): boolean;
    persist(): void;
    preventDefault(): void;
    stopPropagation(): void;
}

Type Parameters

  • T = Element

Hierarchy (view full)

Properties

altKey: boolean
bubbles: boolean
cancelable: boolean
charCode: number
ctrlKey: boolean
currentTarget: EventTarget & T
defaultPrevented: boolean
eventPhase: number
isTrusted: boolean
key: string

See the DOM Level 3 Events spec. for possible values

keyCode: number
locale: string
location: number
metaKey: boolean
nativeEvent: KeyboardEvent
repeat: boolean
shiftKey: boolean
target: EventTarget
timeStamp: number
type: string
which: number

Methods

  • See DOM Level 3 Events spec. for a list of valid (case-sensitive) arguments to this method.

    Parameters

    • key: string

    Returns boolean

  • Returns void