eufy-mega / client/eufy-mega / AnyDeviceEvent
Type Alias: AnyDeviceEvent
ts
type AnyDeviceEvent = { [K in keyof DeviceEventMap]: DeviceEventMap[K] & { eventName: K } }[keyof DeviceEventMap];A single semantic event tagged with its name — the payload of the catch-all "event" listener. A discriminated union over DeviceEventMap, so switching on e.eventName narrows e to that event's payload. Lets a consumer fan every device event to one bus/handler without registering a listener per name (eufy.on("event", e => bus.emit(e.eventName, e))).
The tag is eventName, not name: an event payload may legitimately carry its own name field, and overwriting it to tag the event would destroy data. Matches the eventName carried on a push event.