UNPKG

@graphql-yoga/typed-event-target

Version:

This is an internal package. Please don't use this package directly. The package will do unexpected breaking changes.

13 lines (12 loc) 794 B
export interface TypedEventListener<TEvent extends CustomEvent> { (evt: TEvent): void; } export interface TypedEventListenerObject<TEvent extends CustomEvent> { handleEvent(object: TEvent): void; } export declare type TypedEventListenerOrEventListenerObject<TEvent extends CustomEvent> = TypedEventListener<TEvent> | TypedEventListenerObject<TEvent>; export interface TypedEventTarget<TEvent extends CustomEvent> extends EventTarget { addEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent> | null, options?: AddEventListenerOptions | boolean): void; dispatchEvent(event: TEvent): boolean; removeEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent> | null, options?: EventListenerOptions | boolean): void; }