@@ -34,9 +34,11 @@ type ConvertArgumentType<Type, ToType> =
3434 ) : (
3535 Type extends Set < infer Member > ? Set < ConvertArgumentType < Member , ToType > > : (
3636 Type extends Map < infer Key , infer Value > ? Map < Key , ConvertArgumentType < Value , ToType > > : (
37- Type extends Record < keyof any , any > ? {
38- [ Property in keyof Type ] : ConvertArgumentType < Type [ Property ] , ToType >
39- } : Type
37+ Type extends Array < infer Member > ? Array < ConvertArgumentType < Member , ToType > > : (
38+ Type extends Record < keyof any , any > ? {
39+ [ Property in keyof Type ] : ConvertArgumentType < Type [ Property ] , ToType >
40+ } : Type
41+ )
4042 )
4143 )
4244 ) ;
@@ -57,21 +59,23 @@ type WithCommands = {
5759 [ P in keyof typeof COMMANDS ] : RedisClientCommandSignature < ( typeof COMMANDS ) [ P ] > ;
5860} ;
5961
62+ export type ExcludeMappedString < S > = string extends S ? never : S ;
63+
6064export type WithModules < M extends RedisModules > = {
61- [ P in keyof M as M [ P ] extends never ? never : P ] : {
62- [ C in keyof M [ P ] ] : RedisClientCommandSignature < M [ P ] [ C ] > ;
65+ [ P in keyof M as ExcludeMappedString < P > ] : {
66+ [ C in keyof M [ P ] as ExcludeMappedString < C > ] : RedisClientCommandSignature < M [ P ] [ C ] > ;
6367 } ;
6468} ;
6569
6670export type WithScripts < S extends RedisScripts > = {
67- [ P in keyof S as S [ P ] extends never ? never : P ] : RedisClientCommandSignature < S [ P ] > ;
71+ [ P in keyof S as ExcludeMappedString < P > ] : RedisClientCommandSignature < S [ P ] > ;
6872} ;
6973
70- export type RedisClientType < M extends RedisModules = Record < string , never > , S extends RedisScripts = Record < string , never > > =
74+ export type RedisClientType < M extends RedisModules , S extends RedisScripts > =
7175 RedisClient < M , S > & WithCommands & WithModules < M > & WithScripts < S > ;
7276
7377export type InstantiableRedisClient < M extends RedisModules , S extends RedisScripts > =
74- new ( ... args : ConstructorParameters < typeof RedisClient > ) => RedisClientType < M , S > ;
78+ new ( options ?: RedisClientOptions < M , S > ) => RedisClientType < M , S > ;
7579
7680export interface ClientCommandOptions extends QueueCommandOptions {
7781 isolated ?: boolean ;
@@ -85,7 +89,7 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
8589 return commandOptions ( options ) ;
8690 }
8791
88- static extend < M extends RedisModules = Record < string , never > , S extends RedisScripts = Record < string , never > > ( plugins ?: RedisPlugins < M , S > ) : InstantiableRedisClient < M , S > {
92+ static extend < M extends RedisModules , S extends RedisScripts > ( plugins ?: RedisPlugins < M , S > ) : InstantiableRedisClient < M , S > {
8993 const Client = < any > extendWithModulesAndScripts ( {
9094 BaseClass : RedisClient ,
9195 modules : plugins ?. modules ,
@@ -101,7 +105,7 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
101105 return Client ;
102106 }
103107
104- static create < M extends RedisModules = Record < string , never > , S extends RedisScripts = Record < string , never > > ( options ?: RedisClientOptions < M , S > ) : RedisClientType < M , S > {
108+ static create < M extends RedisModules , S extends RedisScripts > ( options ?: RedisClientOptions < M , S > ) : RedisClientType < M , S > {
105109 return new ( RedisClient . extend ( options ) ) ( options ) ;
106110 }
107111
0 commit comments