type-alias / @typed/template/EventHandler

EventOf

Extracts the native event type accepted by an EventHandler.

Package version
1.0.0-beta.7
Category
Native event types
Since
1.0.0

Import

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

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