Open
Description
Motivation
When using the node-redis package in TypeScript, it's not immediately clear what the correct type for a Redis client should be. Currently, attempting to use the RedisClientType leads to type errors:
import { createClient, RedisClientType } from "redis";
function useClient(redis: RedisClientType) {}
const client = createClient();
useClient(client);
// ~~~~ type error
To work around this, many developers resort to using ReturnType to type their client instances, as discussed in this StackOverflow thread. This approach is not intuitive.
Expected Behavior
The redis package should provide a dedicated and explicit type for the Redis client that accurately reflects the return type of createClient. This would allow developers to type their Redis clients directly without resorting to workarounds.
Basic Code Example
No response
Metadata
Assignees
Labels
No labels