-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type system disagrees!!! #1572
Comments
Hi @LRagji 👋 You are not doing anything wrong. It's should be a bug on ioredis's TypeScript declaration. Going to fix it in the next version. For now, there are two workarounds: const y: [name: string, ...args: string[]][] = [
["set", "foo", "bar"],
["get", "foo"],
];
const result = await this.redisClient.multi(y).exec(); Or const result = await this.redisClient.multi([
["set", "foo", "bar"],
["get", "foo"],
])
.exec(); |
Thanks @luin for confirming, i am using 3rd option |
Aha I should have mentioned it. Actually you should use |
🎉 This issue has been resolved in version 5.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Using v5.0.4 with typescript like below and the multi command fails in compilation
Error reported build time:(wigly under y in multi method)
No overload matches this call. Overload 1 of 4, '(options: { pipeline: false; }): Promise<"OK">', gave the following error. Argument of type 'string[][]' is not assignable to parameter of type '{ pipeline: false; }'. Property 'pipeline' is missing in type 'string[][]' but required in type '{ pipeline: false; }'. Overload 2 of 4, '(options: { pipeline: true; }): ChainableCommander', gave the following error. Argument of type 'string[][]' is not assignable to parameter of type '{ pipeline: true; }'. Property 'pipeline' is missing in type 'string[][]' but required in type '{ pipeline: true; }'. Overload 3 of 4, '(commands?: [name: string, ...args: unknown[]][]): ChainableCommander', gave the following error. Argument of type 'string[][]' is not assignable to parameter of type '[name: string, ...args: unknown[]][]'. Type 'string[]' is not assignable to type '[name: string, ...args: unknown[]]'. Source provides no match for required element at position 0 in target.ts(2769)
Where as following works without any issue:
const result = await this.redisClient.multi([ ["set", "foo", "bar"], ["get", "foo"], ]) .exec();
What am i doing wrong ?
The text was updated successfully, but these errors were encountered: