-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken types #552
Comments
I also want to share some feedback: First of all thanks for your work While I understand that there was a reason to make all these changes the interface of v9 was better. I especially miss decorators. I tried to migrate to the new version but the health indicator is not updated and useFactory has wrong typings so I decided to stay on v9 for now |
Just tried to update to v10 and found the same issue. I'll postpone updating until this issue is resolved. |
I decided to ignore the error like that until the fix is there - since I am doing a big version jump and there are lot of related dependencies, I would rather not spend time checking how compatible they are with v9 right now everything else works :) RedisModule.forRootAsync({
// @ts-expect-error
useFactory: async (config: ConfigService) => ({
readyLog: true,
config: {
host: config.get('REDIS_HOST'),
port: +config.get('REDIS_PORT'),
password: '',
},
}) as any,
imports: [ConfigModule],
inject: [ConfigService],
}), |
I'm doing something similar to @ninja- RedisModule.forRootAsync({
useFactory: ((configService: ConfigService) => {
return redisConfig(configService);
} ) as (...args: unknown[]) => Promise<RedisModuleOptions>,
inject: [ConfigService],
}), I'm just curious what prompted this change? |
Same issue |
@iamkanguk97 can you provide steps to reproduce ?can you share your code for useFactory ? |
This bug has been fixed(#554), please wait for the next major release: nestjs-redis v11 with new features(Using an existing Redis instance, provide custom loggerContext and loggerTimestamp, some hooks used for Transforming Arguments & Replies, etc..), and new |
@R11baka Hello! I'm sorry for the late reply. export interface RedisModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useFactory?: (...args: unknown[]) => RedisModuleOptions | Promise<RedisModuleOptions>;
useClass?: Type<RedisOptionsFactory>;
useExisting?: Type<RedisOptionsFactory>;
inject?: InjectionToken[] | OptionalFactoryDependency[];
extraProviders?: Provider[];
}
export interface RedisOptionsFactory {
createRedisOptions: () => RedisModuleOptions | Promise<RedisModuleOptions>;
} This is my useFactory code. Also, I'm using @liaoliaots/nestjs-redis 10 version and nest version is also 10. For Reference, I temporarily solved it as follows: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
useFactory: (configService: ConfigService): RedisModuleOptions => {
const config = getAppConfig(configService);
const { HOST, PORT, PASSWORD } = config.REDIS;
return {
config: {
host: HOST,
port: +PORT,
password: PASSWORD,
},
readyLog: true,
errorLog: true,
};
}, Hope you have a good day. |
And support node-redis v4 (redis & cluster), update redis-health lib. |
Describe the bug
How to fix
rollback types for
it should be
any
notunknown
The text was updated successfully, but these errors were encountered: