Skip to content

Commit

Permalink
feat: ✨ export TypedEventListener types
Browse files Browse the repository at this point in the history
  • Loading branch information
DerZade committed Oct 23, 2023
1 parent 89f2f51 commit ad40629
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/TypedEventTarget.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
type TypedEventListener<M, T extends keyof M> = (
export type TypedEventListener<M, T extends keyof M> = (
evt: M[T]
) => void | Promise<void>;

interface TypedEventListenerObject<M, T extends keyof M> {
export interface TypedEventListenerObject<M, T extends keyof M> {
handleEvent: (evt: M[T]) => void | Promise<void>;
}

export type TypedEventListenerOrEventListenerObject<M, T extends keyof M> =
| TypedEventListener<M, T>
| TypedEventListenerObject<M, T>;

type ValueIsEvent<T> = {
[key in keyof T]: Event;
};

type TypedEventListenerOrEventListenerObject<M, T extends keyof M> =
| TypedEventListener<M, T>
| TypedEventListenerObject<M, T>;

export interface TypedEventTarget<M extends ValueIsEvent<M>> {
/** Appends an event listener for events whose type attribute value is type.
* The callback argument sets the callback that will be invoked when the event
Expand Down

0 comments on commit ad40629

Please sign in to comment.