1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fix sentinel generics (#2859)

* fix sentinel generics

* comment nit
This commit is contained in:
Shaya Potter
2024-11-04 17:23:34 +02:00
committed by GitHub
parent 4708736f3b
commit 8dab27ed02
2 changed files with 10 additions and 8 deletions

View File

@@ -93,10 +93,10 @@ export class RedisSentinelClient<
RESP extends RespVersions = 2,
TYPE_MAPPING extends TypeMapping = {}
>(
options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>,
internal: RedisSentinelInternal<M, F, S, RESP, TYPE_MAPPING>,
clientInfo: ClientInfo,
commandOptions?: CommandOptions<TYPE_MAPPING>,
options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>
) {
return RedisSentinelClient.factory(options)(internal, clientInfo, commandOptions);
}
@@ -272,7 +272,7 @@ export default class RedisSentinel<
this.#options = options;
if (options?.commandOptions) {
if (options.commandOptions) {
this.#commandOptions = options.commandOptions;
}
@@ -307,7 +307,7 @@ export default class RedisSentinel<
Sentinel.prototype.Multi = RedisSentinelMultiCommand.extend(config);
return (options?: Omit<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => {
return (options: Omit<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => {
// returning a "proxy" to prevent the namespaces.self to leak between "proxies"
return Object.create(new Sentinel(options)) as RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>;
};
@@ -319,7 +319,7 @@ export default class RedisSentinel<
S extends RedisScripts = {},
RESP extends RespVersions = 2,
TYPE_MAPPING extends TypeMapping = {}
>(options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {
>(options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {
return RedisSentinel.factory(options)(options);
}
@@ -409,7 +409,7 @@ export default class RedisSentinel<
try {
return await fn(
RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options)
RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions)
);
} finally {
const promise = this._self.#internal.releaseClientLease(clientInfo);
@@ -510,7 +510,7 @@ export default class RedisSentinel<
async aquire(): Promise<RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>> {
const clientInfo = await this._self.#internal.getClientLease();
return RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options);
return RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions);
}
getSentinelNode(): RedisNode | undefined {