From 2432acae3eb4c956b16c2303d3f470ecc27a5da8 Mon Sep 17 00:00:00 2001 From: Sebastian Ware Date: Mon, 4 Dec 2023 11:48:28 +0100 Subject: [PATCH] addEventListener won't accept SemiSyntheticEvent due to extra helper methods, so we need to mark them as optional. --- packages/inferno/src/DOM/events/delegation.ts | 4 +--- packages/inferno/src/core/types.ts | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/inferno/src/DOM/events/delegation.ts b/packages/inferno/src/DOM/events/delegation.ts index a2db5387b..4ceb5162b 100644 --- a/packages/inferno/src/DOM/events/delegation.ts +++ b/packages/inferno/src/DOM/events/delegation.ts @@ -184,9 +184,7 @@ function rootEvent(name: string): (event: SemiSyntheticEvent) => void { function attachEventToDocument( name: string, ): (event: SemiSyntheticEvent) => void { - const attachedEvent = rootEvent(name); - // @ts-expect-error TODO: FIXME + const attachedEvent = rootEvent(name); document.addEventListener(normalizeEventName(name), attachedEvent); - return attachedEvent; } diff --git a/packages/inferno/src/core/types.ts b/packages/inferno/src/core/types.ts index c273acc74..9a098868d 100644 --- a/packages/inferno/src/core/types.ts +++ b/packages/inferno/src/core/types.ts @@ -79,8 +79,8 @@ export interface SemiSyntheticEvent 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 = SemiSyntheticEvent & NativeClipboardEvent;