Skip to content

Sonarlint throwing a TypeError warning for AMQPConsumer / q.subscribe using example on README #92

Open
@JoshJarabek7

Description

@JoshJarabek7

AMQPConsumer / await q.subscribe callback is set to return a type <void>, however, the example on the README is a Promise<void>

This part:

    const consumer = await q.subscribe({noAck: true}, async (msg) => {
      console.log(msg.bodyToString())
      await consumer.cancel()
    })

Warning:

Promise returned in function argument where a void return was expected.sonarlint(typescript:S6544)
(parameter) msg: AMQPMessage

Dropping the async in front of message gets rid of the squiggles:

const consumer = await queue.subscribe({ noAck: true }, (msg: AMQPMessage) => {
	const message = msg.bodyToString()
	console.log(message)
})

Should probably be <void> | Promise<void>

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions