This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 388
EventKey should be also enumerable #133
Comments
For anyone interested in a workarround: This is my temp solution.
Extend this class and you can fire your own event as enumeration defined by |
I have never used TypeScript, so I'm really not sure about this. I let the .ts definitions into the repository since it was backwards compatible and could help some people. If you can alter this to what you need in a backwards compatible way, I would consider a PR. If not, maybe the extension of the class is fine? |
Thanks for replying. I will go with the workarround until i have time create a pull request. |
Created a PR #134 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
My current Issue is, that the declared type EventKey is from string | RegExp. I cannot declare an event enumeration in my project to have a better overview of my existing events.
My first Idea ist to update the EventEmitter as generic class to pass the possible type like this:
export class EventEmitter<EventType = EventKey> { ... on(event: EventType, listener: Listener|Function): this; ... }
What do you think about that?
The text was updated successfully, but these errors were encountered: