Skip to content

5.0.0 HGETALL returns type doesn't make sens in TS #2933

Closed
@oom-

Description

@oom-

Description

Since the 5.0.0 I'm having typescript error when using HGETALL

In the documentation :

Replies will be transformed into useful data structures:

await client.hGetAll("key"); // { field1: 'value1', field2: 'value2' }
await client.hVals("key"); // ['value1', 'value2']

In VS Code:

const data = await this.redisClient.HGETALL(group);
return Object.entries(data).map((entry) => {
    const value = parseFloat(entry[1]);
                             ^^^^^^^^^
    return { key: entry[0], value: isNaN(value) ? null : value };
});

Argument of type '{ toString: {}; }' is not assignable to parameter of type 'string'.
(parameter) entry: [string, {
toString: {};
}]

In 4.7.0, the TS type of the entry was:
(parameter) entry: [string, string]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions