skip to Main Content

I have updated my typescript version from 4.9.5 to 5.1.6 in my NestJs project and @InjectRedis no longer works

This is the code:

@Injectable() export class MyService { constructor( @InjectRedis('REDIS') private readonly redisService: Redis, ) {} ... }

The error I receive is: "Unable to resolve signature of parameter decorator when called as an expression.
Argument of type ‘undefined’ is not assignable to parameter of type ‘string | symbol’."

Maybe someone has an idea on how to fix it?

I really have no idea where to start to fix it.

2

Answers


  1. Chosen as BEST ANSWER

    I have not been able to find a clean solution for this. But I have created this issue https://github.com/nest-modules/ioredis/issues/267.

    However, a workaround may be @(InjectRedis as any)('REDIS') instead of @InjectRedis('REDIS').


  2. That limitation was fixed on @nestjs/common v9.3.0

    Make sure you have you’re using the latest version (or at least the latest of NestJS v9) of all your @nestjs/* packages

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search