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

Node Client: zadd does not support -inf and inf for score #3360

Open
woodne opened this issue Mar 12, 2025 · 5 comments · May be fixed by #3370
Open

Node Client: zadd does not support -inf and inf for score #3360

woodne opened this issue Mar 12, 2025 · 5 comments · May be fixed by #3370
Labels
bug Something isn't working User issue Issue openned by users Users Pain An issue known to cause users pain, generaly open by the user.

Comments

@woodne
Copy link

woodne commented Mar 12, 2025

Describe the bug

The type parameters of the nodejs client do not allow the special cases of -inf and +inf as described in the valkey zadd command documentation. Is this an intentional omission, or a miss?

Typescript playground: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgcQDbACYFMDC6sB28AvnAGZQQhwDkAAgG4CGqA1lgJ4D0zbnAtAHN02GgG4AUBIDGEAgGd40-ETgBeOEwDuTYPDSZcKmADppULExhHghGAAoEEuC80YMF+fKzyAXHABtAF0AGgliAEpJCW1dJWMTAC8md3sAIhAOAGlONJDEOD0sEABGfxL8opAAJn80-mACMjS4SKA

Expected Behavior

Expect to be able to set score to -inf or +inf for zadd command

Current Behavior

The types for zadd do not allow it, and get a compilation error: https://github.com/valkey-io/valkey-glide/blob/main/node/src/BaseClient.ts#L4021-L4025

Reproduction Steps

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgcQDbACYFMDC6sB28AvnAGZQQhwDkAAgG4CGqA1lgJ4D0zbnAtAHN02GgG4AUBIDGEAgGd40-ETgBeOEwDuTYPDSZcKmADppULExhHghGAAoEEuC80YMF+fKzyAXHABtAF0AGgliAEpJCW1dJWMTAC8md3sAIhAOAGlONJDEOD0sEABGfxL8opAAJn80-mACMjS4SKA

Possible Solution

No response

Additional Information/Context

No response

Client version used

1.3.0

Engine type and version

Valkey 7.0

OS

macOS

Language

TypeScript

Language Version

TypeScript 5.6.3

Cluster information

No response

Logs

No response

Other information

No response

@woodne woodne added the bug Something isn't working label Mar 12, 2025
@asafpamzn asafpamzn added Users Pain An issue known to cause users pain, generaly open by the user. User issue Issue openned by users labels Mar 12, 2025
@jamesx-improving
Copy link
Collaborator

Thank you for reporting this issue! We are prioritizing it and will have a fix soon.

@shohamazon
Copy link
Collaborator

shohamazon commented Mar 12, 2025

Hello @woodne 🙂

Thanks for pointing this out! This was an unintended omission, and we will address it in the upcoming release. 🚀

Is this currently blocking you? If so, we can provide a patch or a release candidate to unblock you sooner. Let us know what works best for you!

@woodne
Copy link
Author

woodne commented Mar 12, 2025

I do not believe it is actively blocking me, I just came across it as I am adapting some code to port from ioredis to glide. I do not think I have actual an actual use for it, so I have a workaround, but just thought I'd point it out.

@shohamazon
Copy link
Collaborator

I understand, thank you so much!

@jamesx-improving
Copy link
Collaborator

Hi @woodne , while we are still working on the fix, there's a confirmed workaround if you really need it:

client.zadd(key1, {infMember: Infinity})

You can use Infinity or -Infinity, which are TS/JS built-in values equal to Number.POSITIVE_INFINITY and Number.NEGATIVE_INFINITY respectively.

@jamesx-improving jamesx-improving linked a pull request Mar 14, 2025 that will close this issue
6 tasks
@avifenesh avifenesh linked a pull request Mar 18, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working User issue Issue openned by users Users Pain An issue known to cause users pain, generaly open by the user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants