Skip to content

Provide also raw interface definition instead of just class #9

@Granjow

Description

@Granjow

First, thanks for this helpful package @binier ! I used to manually declare onX(…) events to enforce typed events until I found it.

One thing I miss is a plain interface definition which I can inherit.

export interface ITypedEmitter<L extends ListenerSignature<L> = DefaultListener> {
    addListener<U extends keyof L>( event: U, listener: L[U] ): this;
    prependListener<U extends keyof L>( event: U, listener: L[U] ): this;
    // etc.
}

export interface MyInterfaceWithEvents extends ITypedEmitter<MyEvents> {
    // …
}

so users of the interface can also rely on typed events, not only users of the instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions