You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix: loop over arguments instead of spreading (#2160)
* fix: loop over arguments instead of spreading * update to use concat * use the returned array from pushVerdictArguments (instead of assuming it'll push to the original array) * fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'." * fix "Argument of type 'RedisCommandArgument | RedisCommandArguments[]' is not assignable to parameter of type 'RedisCommandArgument | RedisCommandArgument[]'" * fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'" Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
This commit is contained in:
@@ -313,8 +313,7 @@ export type Filter = string | Array<string>;
|
||||
|
||||
export function pushFilterArgument(args: RedisCommandArguments, filter: string | Array<string>): RedisCommandArguments {
|
||||
args.push('FILTER');
|
||||
pushVerdictArguments(args, filter);
|
||||
return args;
|
||||
return pushVerdictArguments(args, filter);
|
||||
}
|
||||
|
||||
export interface MRangeOptions extends RangeOptions {
|
||||
@@ -328,10 +327,9 @@ export function pushMRangeArguments(
|
||||
filter: Filter,
|
||||
options?: MRangeOptions
|
||||
): RedisCommandArguments {
|
||||
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
pushFilterArgument(args, filter);
|
||||
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
return args;
|
||||
args = pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
args = pushFilterArgument(args, filter);
|
||||
return pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
}
|
||||
|
||||
export type SelectedLabels = string | Array<string>;
|
||||
@@ -341,7 +339,7 @@ export function pushWithLabelsArgument(args: RedisCommandArguments, selectedLabe
|
||||
args.push('WITHLABELS');
|
||||
} else {
|
||||
args.push('SELECTED_LABELS');
|
||||
pushVerdictArguments(args, selectedLabels);
|
||||
args = pushVerdictArguments(args, selectedLabels);
|
||||
}
|
||||
|
||||
return args;
|
||||
@@ -358,11 +356,10 @@ export function pushMRangeWithLabelsArguments(
|
||||
filter: Filter,
|
||||
options?: MRangeWithLabelsOptions
|
||||
): RedisCommandArguments {
|
||||
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
||||
pushFilterArgument(args, filter);
|
||||
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
return args;
|
||||
args = pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
||||
args = pushFilterArgument(args, filter);
|
||||
return pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
}
|
||||
|
||||
export function transformRangeReply(reply: Array<SampleRawReply>): Array<SampleReply> {
|
||||
|
Reference in New Issue
Block a user