diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 0e348ea430..b9937fc390 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -226,6 +226,8 @@ declare namespace IORedis { zadd(key: KeyType, ...args: string[]): Promise; + zaddBuffer(key: KeyType, score1: number, member1: Buffer): Promise; + zincrby(key: KeyType, increment: number, member: string, callback: (err: Error, res: any) => void): void; zincrby(key: KeyType, increment: number, member: string): Promise; @@ -448,6 +450,8 @@ declare namespace IORedis { publish(channel: string, message: string, callback: (err: Error, res: number) => void): void; publish(channel: string, message: string): Promise; + publishBuffer(channel: string, message: Buffer): Promise; + watch(...keys: KeyType[]): any; unwatch(callback: (err: Error, res: string) => void): void; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index da6681ab65..4b6d2b0da9 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -85,7 +85,7 @@ redis.subscribe('news', 'music', (err: any, count: any) => { // `count` represents the number of channels we are currently subscribed to. pub.publish('news', 'Hello world!'); - pub.publish('music', 'Hello again!'); + pub.publishBuffer('music', Buffer.from('Hello again!')); }); redis.on('message', (channel: any, message: any) => { @@ -272,3 +272,7 @@ const defineCommandResult = cluster.defineCommand('defineCommand', { }); console.log(defineCommandResult); cluster.sendCommand(); + +redis.zaddBuffer('foo', 1, Buffer.from('bar')).then(() => { + // sorted set 'foo' now has score 'foo1' containing barBuffer +}); diff --git a/types/ioredis/v3/index.d.ts b/types/ioredis/v3/index.d.ts index c58a1d16cc..cf164ee769 100644 --- a/types/ioredis/v3/index.d.ts +++ b/types/ioredis/v3/index.d.ts @@ -221,6 +221,8 @@ declare namespace IORedis { zadd(key: string, ...args: string[]): any; + zaddBuffer(key: string, score1: number, member1: Buffer): Promise; + zincrby(key: string, increment: number, member: string, callback: (err: Error, res: any) => void): void; zincrby(key: string, increment: number, member: string): Promise; @@ -439,6 +441,8 @@ declare namespace IORedis { publish(channel: string, message: string, callback: (err: Error, res: number) => void): void; publish(channel: string, message: string): Promise; + publishBuffer(channel: string, message: Buffer): Promise; + watch(...keys: string[]): any; unwatch(callback: (err: Error, res: string) => void): void; diff --git a/types/ioredis/v3/ioredis-tests.ts b/types/ioredis/v3/ioredis-tests.ts index b2ac8e6de0..f05ed73114 100644 --- a/types/ioredis/v3/ioredis-tests.ts +++ b/types/ioredis/v3/ioredis-tests.ts @@ -74,7 +74,7 @@ redis.subscribe('news', 'music', (err: any, count: any) => { // `count` represents the number of channels we are currently subscribed to. pub.publish('news', 'Hello world!'); - pub.publish('music', 'Hello again!'); + pub.publishBuffer('music', Buffer.from('Hello again!')); }); redis.on('message', (channel: any, message: any) => { @@ -180,3 +180,7 @@ new Redis.Cluster([], { new Redis.Cluster([], { clusterRetryStrategy: (times: number) => 1 }); + +redis.zaddBuffer('foo', 1, Buffer.from('bar')).then(() => { + // sorted set 'foo' now has score 'foo1' containing barBuffer +});