小编lul*_*u33的帖子

Typescript 无法解析 vscode 中装饰器参数的签名

当我在 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)

typescript visual-studio-code nestjs

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

nestjs ×1

typescript ×1

visual-studio-code ×1