Skip to content

Commit 08c9072

Browse files
committedMar 19, 2022
fix: add missing declaration for callBuffer
1 parent 6942cec commit 08c9072

File tree

7 files changed

+240
-575
lines changed

7 files changed

+240
-575
lines changed
 

‎bin/generateRedisCommander/template.ts

+19
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ interface RedisCommander<Context extends ClientContext = { type: "default" }> {
5050
call(
5151
...args: [command: string, ...args: (string | Buffer | number)[]]
5252
): Result<unknown, Context>;
53+
callBuffer(
54+
command: string,
55+
callback?: Callback<unknown>
56+
): Result<unknown, Context>;
57+
callBuffer(
58+
command: string,
59+
args: (string | Buffer | number)[],
60+
callback?: Callback<unknown>
61+
): Result<unknown, Context>;
62+
callBuffer(
63+
...args: [
64+
command: string,
65+
...args: (string | Buffer | number)[],
66+
callback: Callback<unknown>
67+
]
68+
): Result<unknown, Context>;
69+
callBuffer(
70+
...args: [command: string, ...args: (string | Buffer | number)[]]
71+
): Result<unknown, Context>;
5372

5473
////
5574
}

‎lib/utils/Commander.ts

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ commands.forEach(function (commandName) {
111111
});
112112

113113
Commander.prototype.call = generateFunction("call", "utf8");
114-
// @ts-expect-error
115114
Commander.prototype.callBuffer = generateFunction("callBuffer", null);
116115
// @ts-expect-error
117116
Commander.prototype.send_command = Commander.prototype.call;

‎lib/utils/RedisCommander.ts

+19
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ interface RedisCommander<Context extends ClientContext = { type: "default" }> {
5050
call(
5151
...args: [command: string, ...args: (string | Buffer | number)[]]
5252
): Result<unknown, Context>;
53+
callBuffer(
54+
command: string,
55+
callback?: Callback<unknown>
56+
): Result<unknown, Context>;
57+
callBuffer(
58+
command: string,
59+
args: (string | Buffer | number)[],
60+
callback?: Callback<unknown>
61+
): Result<unknown, Context>;
62+
callBuffer(
63+
...args: [
64+
command: string,
65+
...args: (string | Buffer | number)[],
66+
callback: Callback<unknown>
67+
]
68+
): Result<unknown, Context>;
69+
callBuffer(
70+
...args: [command: string, ...args: (string | Buffer | number)[]]
71+
): Result<unknown, Context>;
5372

5473
/**
5574
* List the ACL categories or the commands inside a category

‎package-lock.json

+199-571
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dependencies": {
4141
"@ioredis/commands": "^1.1.0",
4242
"cluster-key-slot": "^1.1.0",
43-
"debug": "^4.3.3",
43+
"debug": "^4.3.4",
4444
"denque": "^2.0.1",
4545
"lodash.defaults": "^4.2.0",
4646
"lodash.isarguments": "^3.1.0",
@@ -49,7 +49,7 @@
4949
"standard-as-callback": "^2.1.0"
5050
},
5151
"devDependencies": {
52-
"@ioredis/interface-generator": "^1.1.0",
52+
"@ioredis/interface-generator": "^1.2.0",
5353
"@semantic-release/changelog": "^6.0.1",
5454
"@semantic-release/commit-analyzer": "^9.0.2",
5555
"@semantic-release/git": "^10.0.1",

‎test-d/commands.test-d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const redis = new Redis();
77
expectType<Promise<unknown>>(redis.call('info'));
88
expectType<Promise<unknown>>(redis.call('set', 'foo', 'bar'));
99
expectType<Promise<unknown>>(redis.call('set', ['foo', 'bar']));
10+
expectType<Promise<unknown>>(redis.callBuffer("set", ["foo", "bar"]));
1011
expectType<Promise<unknown>>(redis.call('set', ['foo', 'bar'], (err, value) => {
1112
expectType<Error | undefined | null>(err);
1213
expectType<unknown | undefined>(value);

‎test/functional/send_command.ts

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ describe("send command", () => {
5959
expect(res).to.eql("OK");
6060
}
6161
);
62-
// @ts-expect-error
6362
redis.callBuffer("get", Buffer.from("foo"), function (err, result) {
6463
expect(result).to.be.instanceof(Buffer);
6564
expect(result.toString()).to.eql("bar");

0 commit comments

Comments
 (0)
Please sign in to comment.