This is due to heavy function type overloading in the redis type definitions and a lack of support within the type declaration of promisify for overloaded functions.
The clean way to fix this would probably require TypeScript to merge support for variadic kinds, or if the redis package provided its own promisified API. Until that happens you can add typecasts to your code.
Approach 1: Cast the results of promisify
You can cast the result of promisify(client.del) to (string | string[]) => Promise<number> and do this for all other promisified redis functions you use.
Approach 2: Add a type overload for promisify
declare module "util" {
function promisify<T, U, R>(fn: redis.OverloadedCommand<T, U, R>): {
(arg1: T, arg2: T | T[]): Promise<U>;
(arg1: T | T[]): Promise<U>;
(...args: Array<T>): Promise<U>;
};
}
This handles functions of type redis.OverloadedCommand, of which del is, but depending on how much of redis you use, you'd would probably also want to add additional overloads to promisify for OverloadedKeyCommand, OverloadedListCommand, OverloadedSetCommand, and OverloadedLastCommand.
redispackage directly, or some promise-based wrapper around it?