diff --git a/lib/transaction.ts b/lib/transaction.ts index 9f0c3ba5..bc3bd066 100644 --- a/lib/transaction.ts +++ b/lib/transaction.ts @@ -5,11 +5,11 @@ import { Callback } from "./types"; import { ChainableCommander } from "./utils/RedisCommander"; export interface Transaction { - pipeline(commands?: [name: string, ...args: unknown[]][]): ChainableCommander; + pipeline(commands?: unknown[][]): ChainableCommander; multi(options: { pipeline: false }): Promise<"OK">; multi(): ChainableCommander; multi(options: { pipeline: true }): ChainableCommander; - multi(commands?: [name: string, ...args: unknown[]][]): ChainableCommander; + multi(commands?: unknown[][]): ChainableCommander; } export function addTransactionSupport(redis) { diff --git a/test/typing/pipeline.test-d.ts b/test/typing/pipeline.test-d.ts index bc412486..b522b5b5 100644 --- a/test/typing/pipeline.test-d.ts +++ b/test/typing/pipeline.test-d.ts @@ -3,11 +3,11 @@ import Redis from "../../built"; const redis = new Redis(); -expectType>( - redis.pipeline().set("foo", "bar").get("foo").exec() -); +type RETURN_TYPE = Promise<[Error | null, unknown][] | null>; + +expectType(redis.pipeline().set("foo", "bar").get("foo").exec()); -expectType>( +expectType( redis .pipeline([ ["set", "foo", "bar"], @@ -15,3 +15,12 @@ expectType>( ]) .exec() ); + +expectType( + redis + .pipeline([ + ["set", Buffer.from("foo"), "bar"], + ["incrby", "foo", 42], + ]) + .exec() +);