Skip to content

Commit f9e2d59

Browse files
committed
docs: document event handler types
1 parent edd39cb commit f9e2d59

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mod.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface RegistryType {
1212
[key: string]: Initializer
1313
}
1414

15+
/** The DOM Event types */
1516
type EventType =
1617
| "click"
1718
| "dblclick"
@@ -59,7 +60,8 @@ type EventType =
5960
| "touchleave"
6061
| "touchcancel"
6162

62-
type EventMap = {
63+
/** The type mapping of {@linkcode EventType} to Event object */
64+
export type EventMap = {
6365
click: MouseEvent
6466
dblclick: MouseEvent
6567
mousedown: MouseEvent
@@ -99,7 +101,8 @@ type EventMap = {
99101
touchcancel: TouchEvent
100102
}
101103

102-
type EventHandler<T extends EventType | string> = (
104+
/** The type of the event handler */
105+
export type EventHandler<T extends EventType | string> = (
103106
e: T extends EventType ? EventMap[T] : CustomEvent,
104107
) => void
105108

0 commit comments

Comments
 (0)