Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript Unable to resolve signature of parameter of decorator in vscode

I'm getting the error when I'm decorating the class in nestjs service.

The Typescript is compiling without errors, and I'm getting this problem only in VSCode.

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'.ts(1239)

My tsconfig

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": false,
    "removeComments": true,
    "strictNullChecks": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2020",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
  }
}

My Class

export class AuthService {
  private readonly logger = new Logger('AuthService');
  constructor(
    private readonly jwtService: JwtService,
    private readonly prisma: PrismaService,
    private readonly passwordService: PasswordService,
    private readonly configService: ConfigService,
    private readonly twilioService: TwilioService,
    private readonly userService: UsersService,
    @InjectQueue('nest-worker') private nestWorkerQueue: Queue,
    @InjectQueue('mailsend') private mailSend: Queue,
    @Inject(CACHE_MANAGER) protected readonly cacheManager: Cache,
    private readonly mailerService: MailService
  ) {}

I tried reinstalling typescript removing node modules, but the problem persists.

like image 425
lulu33 Avatar asked Jan 21 '26 04:01

lulu33


2 Answers

i've encountered the same issue with this error: "Unable to resolve signature of class decorator when called as an expression. The runtime will invoke the decorator with 2 arguments, but the decorator expects 1".
and the fix that worked for me was:

  1. open the vscode command palette
  2. enter "Select TypeScript Version"
  3. choose "use workspace version"
like image 123
relbns Avatar answered Jan 23 '26 19:01

relbns


Check your extensions. For me remove "JavaScript and TypeScript Nightly" extension solved this problem.

like image 27
Kamil Avatar answered Jan 23 '26 21:01

Kamil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!