From 07de97d8f6780c06b79ab16d6db7309440efe2da Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 3 Nov 2023 15:52:35 +0000 Subject: [PATCH] fix!: remove event emitter type from interfaces All code should be using `TypedEventEmitter` instead of `EventEmitter` so remove the re-export from the interfaces package. BREAKING CHANGE: removed EventEmitter re-export - please use TypedEventEmitter instead --- packages/interface/src/events.ts | 3 --- packages/peer-discovery-mdns/src/mdns.ts | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/interface/src/events.ts b/packages/interface/src/events.ts index 4c4a498fc3..e7fb860983 100644 --- a/packages/interface/src/events.ts +++ b/packages/interface/src/events.ts @@ -117,9 +117,6 @@ class CustomEventPolyfill extends Event { export const CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill -// TODO: remove this in v1 -export { TypedEventEmitter as EventEmitter } - // create a setMaxListeners that doesn't break browser usage export const setMaxListeners: typeof nodeSetMaxListeners = (n, ...eventTargets) => { try { diff --git a/packages/peer-discovery-mdns/src/mdns.ts b/packages/peer-discovery-mdns/src/mdns.ts index 4cfc1a4dea..6c748d5657 100644 --- a/packages/peer-discovery-mdns/src/mdns.ts +++ b/packages/peer-discovery-mdns/src/mdns.ts @@ -1,4 +1,4 @@ -import { CustomEvent, EventEmitter } from '@libp2p/interface/events' +import { CustomEvent, TypedEventEmitter } from '@libp2p/interface/events' import { peerDiscovery } from '@libp2p/interface/peer-discovery' import multicastDNS from 'multicast-dns' import * as query from './query.js' @@ -23,7 +23,7 @@ export interface MulticastDNSComponents { logger: ComponentLogger } -export class MulticastDNS extends EventEmitter implements PeerDiscovery, Startable { +export class MulticastDNS extends TypedEventEmitter implements PeerDiscovery, Startable { public mdns?: multicastDNS.MulticastDNS private readonly log: Logger