ExtendEventProvider TypeAlias
Allows an interface to extend interfaces that already extend an IEventProvider.
Signature
export type ExtendEventProvider<TBaseEvent extends IEvent, TBase extends IEventProvider<TBaseEvent>, TEvent extends TBaseEvent> = Omit<Omit<Omit<TBase, "on">, "once">, "off"> & IEventProvider<TBaseEvent> & IEventProvider<TEvent>;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
TBaseEvent | IEvent | |
TBase | IEventProvider<TBaseEvent> | |
TEvent | TBaseEvent |
Example
interface AEvents extends IEvent{
(event: "a-event",listener: (a: number)=>void);
}
interface A extends IEventProvider<AEvents>{
a: object;
}
interface BEvents extends IEvent{
(event: "b-event",listener: (b: string)=>void);
}
interface B extends ExtendEventProvider<AEvents, A, BEvents>{
b: boolean;
};
interface B will now extend interface A and its events