Blizzard / Blizzard/node-rdkafka
consume callback has an incorrect typing
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 403
- PR merge metrics
- No merged PRs in 30d
Description
**Environment Information**
- node-rdkafka version [e.g. 2.3.3]: 2.18.0
**Steps to Reproduce**
Use `.consume(callback)` from typescript. Type of "messages" in the callback is `Message[]` while the lib returns a single message. I have to force cast it to use it:
```
consumer.consume((err, msg) => {
const message = msg as unknown as RDKafka.Message;
```
The .consume variant with two parameters is alright
Contributor guide
Research direction
Start with the TypeScript typing for the `.consume(callback)` entry point and compare it with the two-parameter `.consume` variant. Verify that the callback's single returned message is typed as `Message`, while the two-parameter variant remains correct, and confirm the example no longer needs a forced cast.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100