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
Currently, all of the rhea interfaces that extend EventEmitter do not provide an EventMap generic argument, so event handlers do not have strong typings.
For example,
import{create_container}from'rhea';constcontainer=create_container();container.on('message',function(context){// context is any and has no intellisense or type safety});
If a generic event map argument is supplied to EventEmitter when extending it, we can get type safety and intellisense on all of the declared events, e.g.
// container.d.tstypeContainerEvents={'message': [EventContext]// add all container events here};interfaceContainerextendsEventEmitter<ContainerEvents>{// ...}
This will give developers intellisense on event names when registering handlers to the EventEmitters and provide typings on the callback arguments.
The text was updated successfully, but these errors were encountered:
Currently, all of the rhea interfaces that extend
EventEmitter
do not provide anEventMap
generic argument, so event handlers do not have strong typings.For example,
If a generic event map argument is supplied to
EventEmitter
when extending it, we can get type safety and intellisense on all of the declared events, e.g.This will give developers intellisense on event names when registering handlers to the
EventEmitter
s and provide typings on the callback arguments.The text was updated successfully, but these errors were encountered: