redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.86k stars 1.87k forks source link

SortByProperty type is incorrect for RediSearch #2342

Closed VladimirChuprazov closed 1 year ago

VladimirChuprazov commented 1 year ago

SortByProperty type accepts only PropertyName type, but should accept just string.

// packages/search/lib/commands/index.ts:137
export type PropertyName = `${'@' | '$.'}${string}`;

export type SortByProperty = PropertyName | {
    BY: PropertyName;
    DIRECTION?: 'ASC' | 'DESC';
};

Even in examples it is used without $. or @ https://github.com/redis/node-redis/blob/master/examples/search-hashes.js#L51

Maybe related to the #2229

Environment:

VladimirChuprazov commented 1 year ago

duplicate of #2229