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, NumberReply, Command, Resp2Reply, TuplesToMapReply } from '../RESP/types';
|
||||
import { ArrayReply, TuplesToMapReply, BlobStringReply, NumberReply, UnwrapReply, Resp2Reply, Command } from '../RESP/types';
|
||||
|
||||
export type ModuleListReply = ArrayReply<TuplesToMapReply<[
|
||||
[BlobStringReply<'name'>, BlobStringReply],
|
||||
@@ -12,11 +12,14 @@ export default {
|
||||
return ['MODULE', 'LIST'];
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<ModuleListReply>) => {
|
||||
return reply.map(module => ({
|
||||
name: module[1],
|
||||
ver: module[3]
|
||||
}));
|
||||
2: (reply: UnwrapReply<Resp2Reply<ModuleListReply>>) => {
|
||||
return reply.map(module => {
|
||||
const unwrapped = module as unknown as UnwrapReply<typeof module>;
|
||||
return {
|
||||
name: unwrapped[1],
|
||||
ver: unwrapped[3]
|
||||
};
|
||||
});
|
||||
},
|
||||
3: undefined as unknown as () => ModuleListReply
|
||||
}
|
||||
|
Reference in New Issue
Block a user