From 9e497d59f88452ebc7fb646fdf02f2d325ed1631 Mon Sep 17 00:00:00 2001 From: ferrantejake Date: Thu, 20 Dec 2018 18:31:30 -0500 Subject: [PATCH 1/2] Add typings for custom errors --- types/redis/index.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index 003361f467..f48dd08237 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -9,6 +9,7 @@ // Bartek Szczepański // Pirasis Leelatanon // Stanislav Dzhus +// Jake Ferrante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/types/npm-redis @@ -76,7 +77,7 @@ export interface OverloadedKeyCommand { (key: string, arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; (key: string, arg1: T, arg2: T, arg3: T, cb?: Callback): R; (key: string, arg1: T, arg2: T, cb?: Callback): R; - (key: string, arg1: T| T[], cb?: Callback): R; + (key: string, arg1: T | T[], cb?: Callback): R; (key: string, ...args: Array>): R; (...args: Array>): R; } @@ -256,8 +257,8 @@ export interface Commands { /** * Pop a value from a list, push it to another list and return it; or block until one is available. */ - brpoplpush(source: string, destination: string, timeout: number, cb?: Callback): R; - BRPOPLPUSH(source: string, destination: string, timeout: number, cb?: Callback): R; + brpoplpush(source: string, destination: string, timeout: number, cb?: Callback): R; + BRPOPLPUSH(source: string, destination: string, timeout: number, cb?: Callback): R; /** * ADDSLOTS - Assign new hash slots to receiving node. @@ -1238,3 +1239,12 @@ export function createClient(redis_url: string, options?: ClientOpts): RedisClie export function createClient(options?: ClientOpts): RedisClient; export function print(err: Error | null, reply: any): void; + +export class RedisError extends Error { } +export class ReplyError extends RedisError { } +export class AbortError extends RedisError { } +export class ParserError extends RedisError { + public offset: number; + public buffer: Buffer; +} +export class AggregateError extends AbortError { } \ No newline at end of file From 26e3b58827b465de11cccae2fb1a859ea84f24ff Mon Sep 17 00:00:00 2001 From: ferrantejake Date: Thu, 20 Dec 2018 19:20:02 -0500 Subject: [PATCH 2/2] Remove public keyword. Add newline to EOF. --- types/redis/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index f48dd08237..eae16b7ff1 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -9,7 +9,7 @@ // Bartek Szczepański // Pirasis Leelatanon // Stanislav Dzhus -// Jake Ferrante +// Jake Ferrante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/types/npm-redis @@ -1244,7 +1244,7 @@ export class RedisError extends Error { } export class ReplyError extends RedisError { } export class AbortError extends RedisError { } export class ParserError extends RedisError { - public offset: number; - public buffer: Buffer; + offset: number; + buffer: Buffer; } -export class AggregateError extends AbortError { } \ No newline at end of file +export class AggregateError extends AbortError { }