Skip to content

Commit

Permalink
addEventListener won't accept SemiSyntheticEvent due to extra helper …
Browse files Browse the repository at this point in the history
…methods, so we need to mark them as optional.
  • Loading branch information
jhsware committed Jan 18, 2024
1 parent 5d3246c commit 2432aca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/inferno/src/DOM/events/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ function rootEvent(name: string): (event: SemiSyntheticEvent<any>) => void {
function attachEventToDocument(
name: string,
): (event: SemiSyntheticEvent<any>) => void {
const attachedEvent = rootEvent(name);
// @ts-expect-error TODO: FIXME
const attachedEvent = rootEvent(name);
document.addEventListener(normalizeEventName(name), attachedEvent);

return attachedEvent;
}
4 changes: 2 additions & 2 deletions packages/inferno/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export interface SemiSyntheticEvent<T> extends Event {
* A reference to the element on which the event listener is registered.
*/
currentTarget: EventTarget & T;
isDefaultPrevented: () => boolean;
isPropagationStopped: () => boolean;
isDefaultPrevented?: () => boolean;
isPropagationStopped?: () => boolean;
}

export type ClipboardEvent<T> = SemiSyntheticEvent<T> & NativeClipboardEvent;
Expand Down

0 comments on commit 2432aca

Please sign in to comment.