Skip to content

Commit

Permalink
Merge pull request #43 from takker99/event-type
Browse files Browse the repository at this point in the history
👍 the type of event is generic
  • Loading branch information
takker99 authored Mar 23, 2023
2 parents 29123a1 + 50a714e commit d1eba5f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions baseStore.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export type BaseStoreListenerInit<Derived extends BaseStore> = {
export type BaseStoreListenerInit<Event, Derived extends BaseStore<Event>> = {
store: Derived;
event: string;
event: Event;
};
export type BaseStoreListener<Derived extends BaseStore> = (
init: BaseStoreListenerInit<Derived>,
export type BaseStoreListener<Event, Derived extends BaseStore<Event>> = (
init: BaseStoreListenerInit<Event, Derived>,
) => void;
export declare class BaseStore {
export declare class BaseStore<Event = string> {
constructor();

public addChangeListener(listener: BaseStoreListener<this>): void;
public removeChangeListener(listener: BaseStoreListener<this>): void;
public addChangeListener(listener: BaseStoreListener<Event, this>): void;
public removeChangeListener(listener: BaseStoreListener<Event, this>): void;
public emitChange(event: string): void;
public get listenersCount(): number;

private _onChangeListeners: BaseStoreListener<this>[];
private _onChangeListeners: BaseStoreListener<Event, this>[];
}

0 comments on commit d1eba5f

Please sign in to comment.