You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EventTarget objects expose an addEventListener method, which registers an EventListener (or EventListenerObject) with the target. An EventListener is simply a function from some Event to void; however, many EventTarget objects pass an argument to their EventListeners with more structure than just Event.
This is a problem because we completely lose type safety when using addEventListener. We're forced to let the argument to the EventListener be any; coercing it to a more specific type gives an error.
EventTarget objects should be generic on the type of events being emitted. This would be a breaking change, though.
The text was updated successfully, but these errors were encountered:
EventTarget
objects expose anaddEventListener
method, which registers anEventListener
(orEventListenerObject
) with the target. AnEventListener
is simply a function from someEvent
tovoid
; however, manyEventTarget
objects pass an argument to theirEventListener
s with more structure than justEvent
.This is a problem because we completely lose type safety when using
addEventListener
. We're forced to let the argument to theEventListener
beany
; coercing it to a more specific type gives an error.EventTarget
objects should be generic on the type of events being emitted. This would be a breaking change, though.The text was updated successfully, but these errors were encountered: