lul*_*u33 6 typescript visual-studio-code nestjs
当我在 Nestjs 服务中装饰类时收到错误。
Typescript 编译时没有错误,并且我仅在 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)
Run Code Online (Sandbox Code Playgroud)
我的 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,
}
}
Run Code Online (Sandbox Code Playgroud)
我的课
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
) {}
Run Code Online (Sandbox Code Playgroud)
我尝试重新安装打字稿删除节点模块,但问题仍然存在。
小智 6
我遇到了与此错误相同的问题:“作为表达式调用时无法解析类装饰器的签名。运行时将使用 2 个参数调用装饰器,但装饰器需要 1”。
对我有用的修复是:
| 归档时间: |
|
| 查看次数: |
12665 次 |
| 最近记录: |