import type * as Schema from '@vegaprotocol/types'; type Event = { __typename?: string; }; type BusEvent = { event?: T | Event; }; export function getEvents( eventType: Schema.BusEventType, busEvents: BusEvent[] ) { return busEvents.reduce((acc, item) => { if (item.event && item.event.__typename === eventType) { acc.push(item.event as T); } return acc; }, []); }