diff --git a/lib/commands/GEOSEARCHSTORE.ts b/lib/commands/GEOSEARCHSTORE.ts index 934abff653..e10622052b 100644 --- a/lib/commands/GEOSEARCHSTORE.ts +++ b/lib/commands/GEOSEARCHSTORE.ts @@ -1,4 +1,4 @@ -import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments, transformReplyNumber } from './generic-transformers'; +import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -30,11 +30,10 @@ export function transformArguments( return args; } +export function transformReply(reply: number): number { + if (typeof reply !== 'number') { + throw new TypeError(`https://github.com/redis/redis/issues/9261`); + } -// in versions 6.2.0-6.2.4 Redis will return an empty array when `src` is empty -// TODO: issue/PR -export function transformReply(reply: number | []): number { - if (typeof reply === 'number') return reply; - - return 0; + return reply; } diff --git a/lib/commands/ZRANGESTORE.ts b/lib/commands/ZRANGESTORE.ts index 55d11296ea..3dd36bab7d 100644 --- a/lib/commands/ZRANGESTORE.ts +++ b/lib/commands/ZRANGESTORE.ts @@ -46,10 +46,10 @@ export function transformArguments(dst: string, src: string, min: number, max: n return args; } -// in versions 6.2.0-6.2.4 Redis will return an empty array when `src` is empty -// https://github.com/redis/redis/pull/9089 -export function transformReply(reply: number | []): number { - if (typeof reply === 'number') return reply; +export function transformReply(reply: number): number { + if (typeof reply !== 'number') { + throw new TypeError(`Upgrade to Redis 6.2.5 and up (https://github.com/redis/redis/pull/9089)`); + }; return 0; }