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
The CustomEvent type, which inherits the Event interface, are both present in the typescript standard library definitions. However they appear to be incompatible with the types this library exports; meaning if you define:
this will not compile, as the CustomEvent class is not seen as fulfilling Event as provided by event-target-shim. Before version 6 of this library, this worked as (although the generic wasn't really being enforced while emitting events):
class MyClass extends EventTarget<{arbitrary: ArbitraryEvent}, {}> {
// …
In looking through the library, I didn't see anywhere that seemed to support this "events plus arbitrary data" pattern that CustomEvent allows. I can replicate it by creating an actual event definition, something like:
…and that's not half bad, but I was wondering if there were any plans to provide interoperability with the types the stdlib already provides, or if there was methods already and I had missed them, or misunderstood some usage.
The text was updated successfully, but these errors were encountered:
I am using this which seems to play nice w/ both types. I use this constructor instead of CustomEvent when emitting events. If I use strict mode, I also get errors if I try to pass an event with the wrong detail or no detail when one is specified.
It seems the problem is the browser's CustomEvent does not template the type field, so it is always just string.
The
CustomEvent
type, which inherits theEvent
interface, are both present in the typescript standard library definitions. However they appear to be incompatible with the types this library exports; meaning if you define:this will not compile, as the
CustomEvent
class is not seen as fulfillingEvent
as provided byevent-target-shim
. Before version 6 of this library, this worked as (although the generic wasn't really being enforced while emitting events):In looking through the library, I didn't see anywhere that seemed to support this "events plus arbitrary data" pattern that
CustomEvent
allows. I can replicate it by creating an actual event definition, something like:…and that's not half bad, but I was wondering if there were any plans to provide interoperability with the types the stdlib already provides, or if there was methods already and I had missed them, or misunderstood some usage.
The text was updated successfully, but these errors were encountered: