Sitelet https://github.com/EventEmitter2/EventEmitter2/pull/294
Skip to content

Improve typescript definitions by using generics - #294

Open
mrdrogdrog wants to merge 1 commit into
EventEmitter2:masterfrom
mrdrogdrog:master
Open

mrdrogdrog wants to merge 1 commit into
EventEmitter2:masterfrom
mrdrogdrog:master

Conversation

@mrdrogdrog

@mrdrogdrog mrdrogdrog commented Sep 19, 2022 •

Copy link
Copy Markdown

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 force-pushed the master branch 3 times, most recently from 530822d to 74f16d9 Compare September 19, 2022 21:54
@mrdrogdrog
mrdrogdrog marked this pull request as draft September 19, 2022 22:17
@mrdrogdrog
mrdrogdrog force-pushed the master branch 2 times, most recently from 2506d9f to efeca18 Compare September 20, 2022 11:40
@mrdrogdrog
mrdrogdrog marked this pull request as ready for review September 20, 2022 11:40
@holgerd77

Copy link
Copy Markdown

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

ylc395 commented Jul 3, 2023 •

Copy link
Copy Markdown

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.

3 participants