Events
Used to specify the kinds of events emitted by an ISubscribable .
Signature
export type Events<E> = {
[P in (string | symbol) & keyof E as IsEvent<E[P]> extends true ? P : never]: E[P];
};
Type Parameters
Parameter | Description |
---|---|
E |
Remarks
Any object type is a valid Events , but only the event-like properties of that type will be included.
Example
interface MyEvents {
load: (user: string, data: IUserData) => void;
error: (errorCode: number) => void;
}