You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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";functionuseClient(redis: RedisClientType){}constclient=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
The text was updated successfully, but these errors were encountered:
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:
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
The text was updated successfully, but these errors were encountered: