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

fix: use typed event emitter class #470

Merged

Conversation

achingbrain
Copy link
Collaborator

The typed EventEmitter class from @libp2p/interface/events has been renamed TypedEventEmitter along with a TypedEventTarget interface.

The old name is still exported so it's a backwards compatible change but it will be removed in a future version of @libp2p/interface so this change future-proofs @chainsafe/libp2p-gossipsub against that upcoming release.

@achingbrain achingbrain requested a review from a team as a code owner October 31, 2023 11:54
detail: { peerId: from, subscriptions }
})
)
this.safeDispatchEvent<SubscriptionChangeData>('subscription-change', {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style of invocation type-checks the detail field.

@achingbrain achingbrain changed the title fix: use typed event emitter classes fix: use typed event emitter class Oct 31, 2023
@achingbrain
Copy link
Collaborator Author

Looks like the custom linting rules in this repo are broken. Upgrading @typescript-eslint/parser may help - or since aegir is being used to build this project, perhaps delete all the custom eslint stuff and just use aegir's linting?

The typed `EventEmitter` class from `@libp2p/interface/events` has
been renamed `TypedEventEmitter` along with a `TypedEventTarget`
interface.

The old name is still exported so it's a backwards compatible change
but it will be removed in a future version of `@libp2p/interface`
so this change future-proofs `@chainsafe/libp2p-gossipsub` against
that upcoming release.
@codecov-commenter
Copy link

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a39115c) 81.35% compared to head (7e2fbe0) 81.35%.

Files Patch % Lines
test/compliance.spec.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #470      +/-   ##
==========================================
- Coverage   81.35%   81.35%   -0.01%     
==========================================
  Files          48       48              
  Lines       12267    12265       -2     
  Branches     1291     1291              
==========================================
- Hits         9980     9978       -2     
  Misses       2287     2287              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wemeetagain wemeetagain merged commit 3af4e7a into ChainSafe:master Nov 21, 2023
9 checks passed
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