Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potentially wrong return type hint for XCLAIM and XAUTOCLAIM #2913

Closed
LiraNuna opened this issue Mar 22, 2025 · 2 comments
Closed

Potentially wrong return type hint for XCLAIM and XAUTOCLAIM #2913

LiraNuna opened this issue Mar 22, 2025 · 2 comments
Labels

Comments

@LiraNuna
Copy link

LiraNuna commented Mar 22, 2025

Description

The return type of XCLAIM and XAUTOCLAIM commands indicates that the resulting messages might be null:

export type StreamMessagesNullReply = Array<StreamMessageReply | null>;

interface XAutoClaimReply {
    nextId: RedisCommandArgument;
    messages: StreamMessagesNullReply;
}

According to the docs of both commands (XCLAIM, XAUTOCLAIM) the reply will always be an array containing stream id and two other arrays.

Is this a mistype? A relic of past redis version? based on my very loose understanding the result should always be Array<StreamMessageReply>. I would love an explanation or if possible, a fix. I'd gladly create a PR for this but prefer to start a discussion for clarification.

Node.js Version

v18.18.0

Redis Server Version

7.4.1

Node Redis Version

4.7.0

Platform

Linux

@LiraNuna LiraNuna added the Bug label Mar 22, 2025
@htemelski
Copy link
Collaborator

Hello @LiraNuna,
Before Redis 7, XCLAIM and XAUTOCLAIM could return nil, this breaking change to the response is documented here.
The union return type is there because we strive to keep the client libraries compatible with the three latest major versions of Redis.

@LiraNuna
Copy link
Author

That makes perfect sense. Thank you for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants