Skip to content

Commit

Permalink
fix(@nestjs/event-emitter): allow non array event metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Maligosus committed Mar 6, 2023
1 parent 03ed674 commit a28ae33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/events-metadata.accessor.ts
Expand Up @@ -10,6 +10,8 @@ export class EventsMetadataAccessor {
getEventHandlerMetadata(
target: Type<unknown>,
): OnEventMetadata[] | undefined {
return this.reflector.get(EVENT_LISTENER_METADATA, target);
const metadata = this.reflector.get(EVENT_LISTENER_METADATA, target);
if (!metadata) return undefined;
return Array.isArray(metadata) ? metadata : [metadata];
}
}

0 comments on commit a28ae33

Please sign in to comment.