Skip to content

does rPopLPush return type should be string instead of number ? #1998

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

Closed
Fabiencdp opened this issue Feb 20, 2022 · 0 comments
Closed

does rPopLPush return type should be string instead of number ? #1998

Fabiencdp opened this issue Feb 20, 2022 · 0 comments
Labels

Comments

@Fabiencdp
Copy link

Fabiencdp commented Feb 20, 2022

With a typeScript project, When assigning a constant to the result of rPopLPush command, TS type the constant to number
In reality, it's a string (the value of element being popped)

Redis tell the same
https://redis.io/commands/rpoplpush#return-value

Short reproduction:

    (async () => {
      const client = createClient(options) as RedisClientType;
      await client.connect();

      await client.lPush("pendingList", "my cool value");

      const res = await client.rPopLPush("pendingList", "doneList"); // res: number | null
      console.log(res); // my cool value
    })();

Is it because of the declaration of RPOPLPUSH.d.ts ?
export declare function transformReply(): number | null;
Should it be string | null or RedisCommandArgument | null
Do you want me to make a PR ?

Environment:

  • Node.js Version: v14.18.2
  • Redis Server Version: 6.2.6
  • Node Redis Version: [email protected]
  • Platform: Ubuntu 20.04.3 LTS
@Fabiencdp Fabiencdp added the Bug label Feb 20, 2022
leibale added a commit that referenced this issue Feb 21, 2022
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

1 participant