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
This means Effect incorrectly expects events of “event type” "type" and "target" with the types of “event object” being string and unknown, respectively, which results in type errors when trying to call any of EventDispatcher’s functions or subclassing it.
A possible fix, without explicitly specifying the event types being used, is:
This will ensure keyof TEventMap resolves to string and TEventMap[T] to any, bypassing the type constraint issues and allowing EventDispatcher’s functions to be used without type errors.
Alternatively:
exportclassEffectextendsEventDispatcher
This follows the default type behavior of EventDispatcher.
I suspect the type definition of EventDispatcher in @types/three was different in the past. Feel free to close this if you think it’s just a compatibility issue of @types/three.
The text was updated successfully, but these errors were encountered:
The types of
Effect
class and other classes that inheritEventDispatcher
are currently defined as:However, the definitions of
EventDispatcher
andEvent
types are:This means
Effect
incorrectly expects events of “event type”"type"
and"target"
with the types of “event object” beingstring
andunknown
, respectively, which results in type errors when trying to call any ofEventDispatcher
’s functions or subclassing it.A possible fix, without explicitly specifying the event types being used, is:
This will ensure
keyof TEventMap
resolves tostring
andTEventMap[T]
toany
, bypassing the type constraint issues and allowingEventDispatcher
’s functions to be used without type errors.Alternatively:
This follows the default type behavior of
EventDispatcher
.I suspect the type definition of
EventDispatcher
in@types/three
was different in the past. Feel free to close this if you think it’s just a compatibility issue of@types/three
.The text was updated successfully, but these errors were encountered: