This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
events dispatchEvent typing #317
Labels
Comments
Unfortunately, the Event type is of type string and there is no way to type-check it. I'm proposing new method with type safety here: #319 |
achingbrain
added a commit
that referenced
this issue
Jan 17, 2023
Adds a type-safe `safeDispatchEvent` method to the `EventEmitter` interface that allows type checking of dispatched events. resolves #317 Co-authored-by: Alex Potsides <[email protected]>
github-actions bot
pushed a commit
that referenced
this issue
Jan 17, 2023
## [@libp2p/interfaces-v3.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.2.0...@libp2p/interfaces-v3.3.0) (2023-01-17) ### Features * safe dispatch event ([#319](#319)) ([8caeee8](8caeee8)), closes [#317](#317) ### Trivial Changes * remove lerna ([#330](#330)) ([6678592](6678592))
🎉 This issue has been resolved in version @libp2p/interfaces-v3.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version @libp2p/interface-mocks-v9.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is there any way to type check the Event.type and .detail for dispatchEvent similar to the add/removeEventListener methods?
js-libp2p-interfaces/packages/interfaces/src/events.ts
Lines 63 to 76 in 913ddb5
The text was updated successfully, but these errors were encountered: