You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
convert "resp types" to interfaces to allow circular references
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ArrayReply, BlobStringReply, NullReply, Command, RedisArgument } from '../RESP/types';
|
||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, NullReply, UnwrapReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
@@ -10,10 +10,13 @@ export default {
|
||||
) {
|
||||
return pushVariadicArguments(['GEOPOS', key], member);
|
||||
},
|
||||
transformReply(reply: ArrayReply<[BlobStringReply, BlobStringReply] | NullReply>) {
|
||||
return reply.map(item => item === null ? null : {
|
||||
longitude: item[0],
|
||||
latitude: item[1]
|
||||
transformReply(reply: UnwrapReply<ArrayReply<TuplesReply<[BlobStringReply, BlobStringReply]> | NullReply>>) {
|
||||
return reply.map(item => {
|
||||
const unwrapped = item as unknown as UnwrapReply<typeof item>;
|
||||
return unwrapped === null ? null : {
|
||||
longitude: unwrapped[0],
|
||||
latitude: unwrapped[1]
|
||||
};
|
||||
});
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user