Merge pull request #16142 from RoadieHQ/typed-event-params
make `EventParams` typed for tidier event handling
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-events-node': patch
|
||||
---
|
||||
|
||||
Make `EventParams` typed for implementing tidier event handling.
|
||||
@@ -14,8 +14,8 @@ export interface EventBroker {
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface EventParams {
|
||||
eventPayload: unknown;
|
||||
export interface EventParams<TPayload = unknown> {
|
||||
eventPayload: TPayload;
|
||||
metadata?: Record<string, string | string[] | undefined>;
|
||||
topic: string;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface EventParams {
|
||||
export interface EventParams<TPayload = unknown> {
|
||||
/**
|
||||
* Topic for which this event should be published.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ export interface EventParams {
|
||||
/**
|
||||
* Event payload.
|
||||
*/
|
||||
eventPayload: unknown;
|
||||
eventPayload: TPayload;
|
||||
/**
|
||||
* Metadata (e.g., HTTP headers and similar for events received from external).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user