Type alias PropagatedEvent<SourceTopic, TargetTopic, Event>

PropagatedEvent<SourceTopic, TargetTopic, Event>: Event extends infer E extends {
        type: string;
    }
    ? Omit<E, "type" | "topic"> & {
        topic: TargetTopic;
        type: PropagatedEventType<SourceTopic, E["type"]>;
    }
    : never

Modifies an event shape to reflect propagation to a parent topic.

Type Parameters

  • SourceTopic extends string

  • TargetTopic extends string

  • Event extends {
        type: string;
    }

Remarks

The 'type' field is prefixed with the original topic, and a new property is added with the original topic's identity.