type-alias / @typed/template

EventHandler.EventOf

Extracts the native event type accepted by an EventHandler.

Package version
1.0.0-beta.13
Category
Native event types
Since
1.0.0
Member of
EventHandler

Import

import { EventHandler } from "@typed/template";

Access EventHandler.EventOf through the imported EventHandler export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export type EventOf<T> = T extends EventHandler<infer Ev, infer _E, infer _R> ? Ev : never;

Why

Integrations can recover the browser event type accepted by the handler. EventSource invokes that handler with its forwarding Proxy, so the static event type is preserved even though callback object identity is distinct.

Ownership and lifetime

This is a compile-time projection and owns no event object.

Examples

import type { EventHandler, EventOf } from "@typed/template/EventHandler"

type Click = EventOf<EventHandler<MouseEvent>>

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source