Skip to content

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

@Fabiencdp

Description

@Fabiencdp

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: redis@4.0.3
  • Platform: Ubuntu 20.04.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions