/** * @description 表示事件表中允许的基础订阅者函数类型。 */ // oxlint-disable-next-line no-explicit-any export type BaseSubscriber = (...args: any[]) => void /** * @description 表示事件表中允许的事件-订阅者关系的约束类型。 * 该类型要求事件表的每个事件都必须对应一个 BaseSubscriber 类型的订阅者函数。 * 通过该约束类型,EventManager 和相关组件能够在编译时确保事件表的正确性。 */ export type EventsConstraint> = { [K in keyof Events]: BaseSubscriber } export type BuildEvents> = { [K in keyof Events]: Events[K] } export interface AnyEvents { [event: string]: BaseSubscriber } /** * @description 表示一次订阅关系的标准化描述。 */ export interface SubscriberEntry, K extends keyof Events> { event: K once: boolean subscriber: Events[K] unsubscribe: () => void }