Skip to content

Commit

Permalink
fix: onBeforeInput event type
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Dec 7, 2023
1 parent 5f816b4 commit 0c7fd52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,8 +1575,8 @@ export namespace JSXInternal {
onChangeCapture?: GenericEventHandler<Target> | undefined;
onInput?: InputEventHandler<Target> | undefined;
onInputCapture?: InputEventHandler<Target> | undefined;
onBeforeInput?: GenericEventHandler<Target> | undefined;
onBeforeInputCapture?: GenericEventHandler<Target> | undefined;
onBeforeInput?: InputEventHandler<Target> | undefined;
onBeforeInputCapture?: InputEventHandler<Target> | undefined;
onSearch?: GenericEventHandler<Target> | undefined;
onSearchCapture?: GenericEventHandler<Target> | undefined;
onSubmit?: SubmitEventHandler<Target> | undefined;
Expand Down
7 changes: 6 additions & 1 deletion test/ts/preact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ const onInput = (e: h.JSX.TargetedInputEvent<HTMLInputElement>) => {};
createElement('input', { onInput: onInput });
h('input', { onInput: onInput });

// Should accept onSubmit
// Should accept onBeforeInput
const onBeforeInput = (e: h.JSX.TargetedInputEvent<HTMLInputElement>) => {};
<input onBeforeInput={e => e.currentTarget.value} />;
createElement('input', { onBeforeInput: onBeforeInput });
h('input', { onBeforeInput: onBeforeInput });

const onSubmit = (e: h.JSX.TargetedSubmitEvent<HTMLFormElement>) => {};
<form onSubmit={e => e.currentTarget.elements} />;
createElement('form', { onSubmit: onSubmit });
Expand Down

0 comments on commit 0c7fd52

Please sign in to comment.