Skip to content

Commit 2fc9b95

Browse files
committed
Make currentTarget non-nullable
1 parent ca964a4 commit 2fc9b95

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.d.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export function on<K extends keyof GlobalEventHandlersEventMap>(name: K, selector: string, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: EventListenerOptions): void;
2-
export function on(name: string, selector: string, listener: EventListener, options?: EventListenerOptions): void;
3-
export function off(name: string, selector: string, listener: EventListener, options?: EventListenerOptions): void;
4-
export function fire(target: EventTarget, name: string, detail?: any): boolean;
1+
type DelegatedEventListener = (this: Element, ev: CustomEvent & {currentTarget: Element}) => any
2+
3+
export function on<K extends keyof GlobalEventHandlersEventMap>(name: K, selector: string, listener: (this: GlobalEventHandlers & Element, ev: GlobalEventHandlersEventMap[K] & {currentTarget: Element}) => any, options?: EventListenerOptions): void;
4+
export function on(name: string, selector: string, listener: DelegatedEventListener, options?: EventListenerOptions): void;
5+
export function off(name: string, selector: string, listener: DelegatedEventListener, options?: EventListenerOptions): void;
6+
export function fire(target: Element, name: string, detail?: any): boolean;

0 commit comments

Comments
 (0)