11import COMMANDS from '../commands' ;
2- import RedisMultiCommand , { MULTI_REPLY , MultiReply , MultiReplyType , RedisMultiQueuedCommand } from '../multi-command' ;
2+ import RedisMultiCommand , { MULTI_MODE , MULTI_REPLY , MultiMode , MultiReply , MultiReplyType , RedisMultiQueuedCommand } from '../multi-command' ;
33import { ReplyWithTypeMapping , CommandReply , Command , CommandArguments , CommanderConfig , RedisFunctions , RedisModules , RedisScripts , RespVersions , TransformReply , RedisScript , RedisFunction , TypeMapping } from '../RESP/types' ;
44import { attachConfig , functionArgumentsPrefix , getTransformReply } from '../commander' ;
55import { BasicCommandParser } from './parser' ;
@@ -13,7 +13,7 @@ type CommandSignature<
1313 S extends RedisScripts ,
1414 RESP extends RespVersions ,
1515 TYPE_MAPPING extends TypeMapping
16- > = ( ...args : Tail < Parameters < C [ 'parseCommand' ] > > ) => RedisClientMultiCommandType <
16+ > = ( ...args : Tail < Parameters < C [ 'parseCommand' ] > > ) => InternalRedisClientMultiCommandType <
1717 [ ...REPLIES , ReplyWithTypeMapping < CommandReply < C , RESP > , TYPE_MAPPING > ] ,
1818 M ,
1919 F ,
@@ -70,7 +70,7 @@ type WithScripts<
7070 [ P in keyof S ] : CommandSignature < REPLIES , S [ P ] , M , F , S , RESP , TYPE_MAPPING > ;
7171} ;
7272
73- export type RedisClientMultiCommandType <
73+ type InternalRedisClientMultiCommandType <
7474 REPLIES extends Array < any > ,
7575 M extends RedisModules ,
7676 F extends RedisFunctions ,
@@ -85,6 +85,19 @@ export type RedisClientMultiCommandType<
8585 WithScripts < REPLIES , M , F , S , RESP , TYPE_MAPPING >
8686) ;
8787
88+ type TypedOrAny < Flag extends MultiMode , T > =
89+ [ Flag ] extends [ MULTI_MODE [ 'TYPED' ] ] ? T : any ;
90+
91+ export type RedisClientMultiCommandType <
92+ isTyped extends MultiMode ,
93+ REPLIES extends Array < any > ,
94+ M extends RedisModules ,
95+ F extends RedisFunctions ,
96+ S extends RedisScripts ,
97+ RESP extends RespVersions ,
98+ TYPE_MAPPING extends TypeMapping
99+ > = TypedOrAny < isTyped , InternalRedisClientMultiCommandType < REPLIES , M , F , S , RESP , TYPE_MAPPING > > ;
100+
88101type ExecuteMulti = ( commands : Array < RedisMultiQueuedCommand > , selectedDB ?: number ) => Promise < Array < unknown > > ;
89102
90103export default class RedisClientMultiCommand < REPLIES = [ ] > {
0 commit comments