Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typescript definitions by using generics #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrdrogdrog
Copy link

@mrdrogdrog mrdrogdrog commented Sep 19, 2022

Inspired by https://github.com/andywer/typed-emitter I replaced the usage of any with generics to make the typescript definitions more type safe. I tried to keep the compatibility with the old types.

You now can define a map of constrains between an event name and the value types which will be enforced by typescript.

@mrdrogdrog mrdrogdrog marked this pull request as draft September 19, 2022 22:17
@mrdrogdrog mrdrogdrog marked this pull request as ready for review September 20, 2022 11:40
@holgerd77
Copy link

Hi there,
we just updated our event emitter from the async-eventemitter package (outdated, not maintained) to eventemitter2 and realized along the way that we lost the event-specific typing along with this https://github.com/ethereumjs/ethereumjs-monorepo/pull/2303/files#r997952802, so just a heads up here that we would be happy if this makes its way into a release. 🙂

@ylc395
Copy link

ylc395 commented Jul 3, 2023

Is this PR similar to #293 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants