Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
* and may lose some pending replies that haven't written to client.
* If you want to wait for the pending replies, use Redis#quit instead.
*/
disconnect(reconnect = false) {

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member disconnect should be declared before all private instance method definitions

Check warning on line 454 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member disconnect should be declared before all private instance method definitions
if (!reconnect) {
this.manuallyClosing = true;
}
Expand All @@ -477,7 +477,7 @@
*
* @deprecated
*/
end() {

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member end should be declared before all private instance method definitions

Check warning on line 480 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member end should be declared before all private instance method definitions
this.disconnect();
}

Expand All @@ -490,10 +490,11 @@
* var anotherRedis = redis.duplicate();
* ```
*/
duplicate<Override extends Partial<RedisOptions> | undefined = undefined>(

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member duplicate should be declared before all private instance method definitions

Check warning on line 493 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member duplicate should be declared before all private instance method definitions
override?: Override
): Redis<ReplyMappingFromOptions<ReplyMapping, Override>> {
return new Redis({
const Ctor = (this.constructor as typeof Redis) || Redis;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid selecting a command as the duplicate constructor

When a client is created with scripts: { constructor: ... } (accepted by the Record<string, ...> option and installed by defineCommand as an own this.constructor method), this lookup selects the generated Lua-command function rather than the Redis class. new Ctor(...) then executes that function against an uninitialized object and throws before creating a duplicate, whereas the previous hard-coded constructor worked; the identical lookup in Cluster.duplicate has the same regression. Resolve the class from the prototype rather than the potentially shadowed instance property.

AGENTS.md reference: AGENTS.md:L88-L88

Useful? React with 👍 / 👎.

return new Ctor({
...this.options,
...(override ?? {}),
}) as Redis<ReplyMappingFromOptions<ReplyMapping, Override>>;
Expand Down Expand Up @@ -539,7 +540,7 @@
* });
* ```
*/
monitor(callback?: Callback<Redis>): Promise<Redis> {

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member monitor should be declared before all private instance method definitions

Check warning on line 543 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member monitor should be declared before all private instance method definitions
const monitorInstance = this.duplicate({
monitor: true,
lazyConnect: false,
Expand Down Expand Up @@ -581,7 +582,7 @@
*
* @ignore
*/
sendCommand(command: Command, stream?: WriteableStream): unknown {

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member sendCommand should be declared before all private instance method definitions

Check warning on line 585 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member sendCommand should be declared before all private instance method definitions
command.setReplyContext(this.condition ?? this.options);

if (this.status === "wait") {
Expand Down Expand Up @@ -1241,23 +1242,23 @@
});
}

scanStream(options?: ScanStreamOptions) {

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member scanStream should be declared before all private instance method definitions

Check warning on line 1245 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member scanStream should be declared before all private instance method definitions
return this.createScanStream("scan", { options });
}

scanBufferStream(options?: ScanStreamOptions) {

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member scanBufferStream should be declared before all private instance method definitions

Check warning on line 1249 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member scanBufferStream should be declared before all private instance method definitions
return this.createScanStream("scanBuffer", { options });
}

sscanStream(key: string, options?: ScanStreamOptions) {

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member sscanStream should be declared before all private instance method definitions

Check warning on line 1253 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member sscanStream should be declared before all private instance method definitions
return this.createScanStream("sscan", { key, options });
}

sscanBufferStream(key: string, options?: ScanStreamOptions) {

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member sscanBufferStream should be declared before all private instance method definitions

Check warning on line 1257 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member sscanBufferStream should be declared before all private instance method definitions
return this.createScanStream("sscanBuffer", { key, options });
}

hscanStream(key: string, options?: ScanStreamOptions) {

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.10.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.10.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.2)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, rs-7.4.0-v1)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.10.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, custom-40894365660-debian)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.2)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.8.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (22.x, 8.2)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, custom-40894365660-debian)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, 8.8.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.8.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, custom-40894365660-debian)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, custom-40894365660-debian)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.2)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, 8.8.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (26.x, rs-7.4.0-v1)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (24.x, rs-7.4.0-v1)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, 8.10.0)

Member hscanStream should be declared before all private instance method definitions

Check warning on line 1261 in lib/Redis.ts

View workflow job for this annotation

GitHub Actions / test / test (20.x, rs-7.4.0-v1)

Member hscanStream should be declared before all private instance method definitions
return this.createScanStream("hscan", { key, options });
}

Expand Down
3 changes: 2 additions & 1 deletion lib/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ class Cluster<
overrideOptions.redisOptions
);
}
return new Cluster(startupNodes, options) as Cluster<
const Ctor = (this.constructor as typeof Cluster) || Cluster;
return new Ctor(startupNodes, options) as Cluster<
ReplyMappingFromClusterOptions<ReplyMapping, OverrideOptions>
>;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/applyMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ function applyMixin(
mixinConstructor: Constructor
) {
Object.getOwnPropertyNames(mixinConstructor.prototype).forEach((name) => {
if (name === "constructor") {
return;
}
Object.defineProperty(
derivedConstructor.prototype,
name,
Expand Down
12 changes: 12 additions & 0 deletions test/functional/duplicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ describe("duplicate", () => {
redis.options.port = 1234;
expect(duplicatedRedis.options.port).to.eql(6379);
});

it("creates an instance of the subclass when duplicated", () => {
class CustomRedis extends Redis {
customMethod() {
return "custom";
}
}
const redis = new CustomRedis({ lazyConnect: true });
const duplicated = redis.duplicate();
expect(duplicated).to.be.instanceOf(CustomRedis);
expect((duplicated as CustomRedis).customMethod()).to.eql("custom");
});
});
13 changes: 13 additions & 0 deletions test/unit/clusters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ describe("cluster", () => {
expect(duplicate.options.subscriberNodeRole).to.eql("slave");
});

it("creates an instance of the subclass when duplicated", () => {
class CustomCluster extends Cluster {
customMethod() {
return "custom";
}
}
const cluster = new CustomCluster([{}], { lazyConnect: true });
const duplicate = cluster.duplicate();

expect(duplicate).to.be.instanceOf(CustomCluster);
expect((duplicate as CustomCluster).customMethod()).to.eql("custom");
});

it("disables slotsRefreshInterval by default", () => {
const cluster = new Cluster([{}]);
expect(cluster.options.slotsRefreshInterval).to.eql(undefined);
Expand Down
Loading