diff options
Diffstat (limited to 'frontend/helper.ts')
-rw-r--r-- | frontend/helper.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/frontend/helper.ts b/frontend/helper.ts index 879d322..827a204 100644 --- a/frontend/helper.ts +++ b/frontend/helper.ts @@ -11,14 +11,14 @@ interface Opts<E> { href?: string, method?: string, placeholder?: string, - onclick?: (e: E) => void, - onchange?: (e: E) => void, + onclick?: (e: Event) => void, + onchange?: (e: Event) => void, } function apply_opts<E extends HTMLElement>(e: E, o: Opts<E>) { if (o.id) e.id = o.id - if (o.onclick) e.onclick = () => o.onclick!(e) - if (o.onchange) e.onchange = () => o.onchange!(e) + if (o.onclick) e.onclick = ev => o.onclick!(ev) + if (o.onchange) e.onchange = ev => o.onchange!(ev) // TODO can we do this properly? if (o.for) (e as unknown as HTMLLabelElement).htmlFor = o.for if (o.type && (e instanceof HTMLInputElement || e instanceof HTMLLinkElement)) e.type = o.type |