From 2cb85e5153145dd2d6719c7fb1c6b62e5ca07e0b Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Sat, 25 Nov 2023 12:47:15 +0000 Subject: [PATCH] fix!: remove event emitter type from interfaces (#2196) 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