diff --git a/lib/event-subscribers.loader.ts b/lib/event-subscribers.loader.ts index 1994244e..70fd08ca 100644 --- a/lib/event-subscribers.loader.ts +++ b/lib/event-subscribers.loader.ts @@ -17,6 +17,7 @@ import { EventEmitter2 } from 'eventemitter2'; import { EventEmitterReadinessWatcher } from './event-emitter-readiness.watcher'; import { EventsMetadataAccessor } from './events-metadata.accessor'; import { OnEventOptions } from './interfaces'; +import { EventRequestObject } from './interfaces/event-request-object.interface'; @Injectable() export class EventSubscribersLoader @@ -138,7 +139,9 @@ export class EventSubscribersLoader event, async (...args: unknown[]) => { const request = this.getRequestFromEventPayload(args); - const contextId = ContextIdFactory.getByRequest({ payload: request }); + const contextId = ContextIdFactory.getByRequest< + EventRequestObject + >({ payload: request }); this.moduleRef.registerRequestByContextId(request, contextId); diff --git a/lib/interfaces/event-request-object.interface.ts b/lib/interfaces/event-request-object.interface.ts new file mode 100644 index 00000000..f8c73e6a --- /dev/null +++ b/lib/interfaces/event-request-object.interface.ts @@ -0,0 +1,3 @@ +export type EventRequestObject = { + payload: T; +};