From cab2b0c00635c52125f3ba7a7bbdf4b0f8362cfe Mon Sep 17 00:00:00 2001 From: yperess Date: Tue, 15 May 2018 12:16:24 -0400 Subject: [PATCH] Fix return type for RedisOptions.reconnectOnError As seen in the source https://github.com/luin/ioredis/blob/cf18554c142f461b3ad7ff716df596d7d1615828/lib/redis/parser.js#L50 the return values for the `reconnectOnError` functions should include `1` and `2`. --- types/ioredis/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index bc3d656985..84ca51982a 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -798,7 +798,11 @@ declare namespace IORedis { * Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858 */ retryStrategy?(times: number): number | false; - reconnectOnError?(error: Error): boolean; + /** + * 1/true means reconnect, 2 means reconnect and resend failed command. Returning false will ignore + * the error and do nothing. + */ + reconnectOnError?(error: Error): boolean | 1 | 2; /** * By default, if there is no active connection to the Redis server, commands are added to a queue * and are executed once the connection is "ready" (when enableReadyCheck is true, "ready" means