From 8c8766655bc796eb3a411f624eff91ddc6896075 Mon Sep 17 00:00:00 2001 From: Josh Jarabek <84693614+JoshJarabek7@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:34:38 -0500 Subject: [PATCH] Fix return type in AMQPConsumer constructor Originally only had void as the return type, and the example on the README.md showed a Promise being returned, causing yellow squiggles from Typescript / Sonarlint. --- src/amqp-consumer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amqp-consumer.ts b/src/amqp-consumer.ts index 2369d9ca..5e342f7b 100644 --- a/src/amqp-consumer.ts +++ b/src/amqp-consumer.ts @@ -8,7 +8,7 @@ import type { AMQPMessage } from './amqp-message.js' export class AMQPConsumer { readonly channel: AMQPChannel readonly tag: string - readonly onMessage: (msg: AMQPMessage) => void + readonly onMessage: (msg: AMQPMessage) => void | Promise private closed = false private closedError?: Error private resolveWait?: (value: void) => void @@ -20,7 +20,7 @@ export class AMQPConsumer { * @param tag - consumer tag * @param onMessage - callback executed when a message arrive */ - constructor(channel: AMQPChannel, tag: string, onMessage: (msg: AMQPMessage) => void) { + constructor(channel: AMQPChannel, tag: string, onMessage: (msg: AMQPMessage) => void | Promise) { this.channel = channel this.tag = tag this.onMessage = onMessage