diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index 5f7e1d1e10..00029fe2d3 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -5,6 +5,7 @@ // TANAKA Koichi // Stuart Schechter // Junyoung Choi +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/types/npm-redis @@ -43,7 +44,7 @@ export interface ClientOpts { password?: string; db?: string | number; family?: string; - rename_commands?: { [command: string]: string }; + rename_commands?: { [command: string]: string } | null; tls?: any; prefix?: string; retry_strategy?: RetryStrategy; @@ -1202,6 +1203,9 @@ export interface RedisClient extends Commands, EventEmitter { send_command(command: string, cb?: Callback): boolean; send_command(command: string, args?: any[], cb?: Callback): boolean; + addCommand(command: string): void; + add_command(command: string): void; + /** * Mark the start of a transaction block. */ diff --git a/types/redis/redis-tests.ts b/types/redis/redis-tests.ts index 25bafc0627..4c38b9046e 100644 --- a/types/redis/redis-tests.ts +++ b/types/redis/redis-tests.ts @@ -6,10 +6,10 @@ const num = 0; const str = 'any string'; const err: Error = new Error(); const args: any[] = []; -const resCallback: (err: Error, res: any) => void = () => null; -const numCallback: (err: Error, res: number) => void = () => null; -const strCallback: (err: Error, res: string) => void = () => null; -const messageHandler: (channel: string, message: any) => void = () => null; +const resCallback: (err: Error | null, res: any) => void = () => {}; +const numCallback: (err: Error | null, res: number) => void = () => {}; +const strCallback: (err: Error | null, res: string) => void = () => {}; +const messageHandler: (channel: string, message: any) => void = () => {}; // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- @@ -117,3 +117,7 @@ client.cork(); client.set("abc", "fff", strCallback); client.get("abc", resCallback); client.uncork(); + +// Add command +client.add_command('my command'); +client.addCommand('my other command'); diff --git a/types/redis/tsconfig.json b/types/redis/tsconfig.json index e79b038103..b99c599145 100644 --- a/types/redis/tsconfig.json +++ b/types/redis/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "redis-tests.ts" ] -} \ No newline at end of file +}