This repository was archived by the owner on Jun 26, 2023. It is now read-only.
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
Type error consuming events #227
Closed
Description
Consuming the events in a downstream library results in a type error:
Example
@chainsafe/lodestar: ../../node_modules/@libp2p/interfaces/dist/src/events.d.ts:18:5 - error TS2416: Property 'addEventListener' in type 'EventEmitter<EventMap>' is not assignable to the same property in base type 'EventTarget'.
@chainsafe/lodestar: Type '<U extends keyof EventMap>(type: U, callback: EventHandler<EventMap[U]>, options?: boolean | AddEventListenerOptions | undefined) => void' is not assignable to type '(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void'.
@chainsafe/lodestar: Types of parameters 'type' and 'type' are incompatible.
@chainsafe/lodestar: Type 'string' is not assignable to type 'keyof EventMap'.
@chainsafe/lodestar: 18 addEventListener<U extends keyof EventMap>(type: U, callback: EventHandler<EventMap[U]>, options?: AddEventListenerOptions | boolean): void;
@chainsafe/lodestar: ~~~~~~~~~~~~~~~~
@chainsafe/lodestar: ../../node_modules/@libp2p/interfaces/dist/src/events.d.ts:19:5 - error TS2416: Property 'removeEventListener' in type 'EventEmitter<EventMap>' is not assignable to the same property in base type 'EventTarget'.
@chainsafe/lodestar: Type '<U extends keyof EventMap>(type: U, callback?: EventHandler<EventMap[U]> | undefined, options?: boolean | EventListenerOptions | undefined) => void' is not assignable to type '(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void'.
@chainsafe/lodestar: Types of parameters 'type' and 'type' are incompatible.
@chainsafe/lodestar: Type 'string' is not assignable to type 'keyof EventMap'.
@chainsafe/lodestar: 19 removeEventListener<U extends keyof EventMap>(type: U, callback?: EventHandler<EventMap[U]> | undefined, options?: EventListenerOptions | boolean): void;
@chainsafe/lodestar: ~~~~~~~~~~~~~~~~~~~