function / @typed/ui/Dom/index

currentTarget

Reads a native event’s non-null current target during handler execution.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Event inspection
Since
1.0.0

Import

import { currentTarget } from "@typed/ui/Dom/index";

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

Signatures

export declare function currentTarget<Target extends EventTarget>(event: Event): Target;

Why

The DOM types currentTarget as nullable because the browser clears it after dispatch. This helper makes the temporal constraint explicit and preserves a caller-selected target type.

Ownership and lifetime

The returned target is borrowed from the live dispatch. Do not treat it as a component-owned node; the helper throws after the handler window closes.

Examples

import { currentTarget } from "@typed/ui/Dom/Events"

const read = (event: Event) => currentTarget<HTMLInputElement>(event).value

Other public imports

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

Source