当我在 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 …Run Code Online (Sandbox Code Playgroud)