-
Notifications
You must be signed in to change notification settings - Fork 1.9k
typescript interface request #1732
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
import { createClient } from '@node-redis/client';
export const client = createClient();
export type RedisClientType = typeof client; |
Hmm, I'm not sure if it's related but I'm getting this error while trying to upgrade to 4.0
And my code is: import { createClient } from "redis";
export const cacheClient = createClient({ url: config.redisUrl }); I'm not sure how to fix it. I've done a decent amount of Typescript work and I haven't run into this particular issue before. |
That works in some cases, but not as function return types (except if I'm missing something) import { createClient } from '@node-redis/client';
function createRedis(): ??? {
return createClient(...)
} |
well, the answer given to me using const client = createClient ... is working ..
|
The advantage of using But I understand that in some cases using the generic type does make sense, and there's already a PR that implements exactly that. I'll merge it soon. |
Duplicate of #1673 |
Probably this may be used as workaround: type RedisClient = ReturnType<typeof createClient>; |
latest version 4
i declare my redisclient upfront but i have to import the redisclienttype seperately
can you re-export it ? so that i don't have to install @node-redis separately
thanks
The text was updated successfully, but these errors were encountered: