Skip to content

BrokerWithExtensions

BrokerWithExtensions<T> = BrokerAsPromised & UnionToIntersection<T[number]>

Defined in: packages/hoppity/src/types.ts:193

Utility type for combining a Rascal broker with extension methods added by middleware. Middleware can attach extra methods onto the broker in their onBrokerCreated callbacks. This type makes those extensions type-safe by intersecting the base BrokerAsPromised with each extension record.

T extends Record<string, any>[]

Tuple of extension record types (e.g., [RpcBrokerExtensions, DelayedPublishExtensions])

type MyBroker = BrokerWithExtensions<[{ rpcCall: (msg: any) => Promise<any> }]>;
// Result: BrokerAsPromised & { rpcCall: (msg: any) => Promise<any> }