From 9e497d59f88452ebc7fb646fdf02f2d325ed1631 Mon Sep 17 00:00:00 2001 From: ferrantejake Date: Thu, 20 Dec 2018 18:31:30 -0500 Subject: [PATCH] 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