diff --git a/src/hooks/useEventEmitter.ts b/src/hooks/useEventEmitter.ts index 6b5693ef95e..8f9d10bc666 100644 --- a/src/hooks/useEventEmitter.ts +++ b/src/hooks/useEventEmitter.ts @@ -15,10 +15,14 @@ limitations under the License. */ import {useRef, useEffect} from "react"; -import type {EventEmitter} from "events"; type Handler = (...args: any[]) => void; +interface EventEmitter { + on(event: string | symbol, listener: (...args: any[]) => void); + removeListener(event: string | symbol, listener: (...args: any[]) => void); +} + // Hook to wrap event emitter on and removeListener in hook lifecycle export const useEventEmitter = (emitter: EventEmitter, eventName: string | symbol, handler: Handler) => { // Create a ref that stores handler