【Debug】此语法需要一个导入的帮助程序,但找不到模块“tslib”

报错如下:

【Debug】此语法需要一个导入的帮助程序,但找不到模块“tslib”_第1张图片
代码可以编译运行,但是会有红线和报错。

解决方法:TypeScript error “TS2354: This syntax requires an imported helper but module ‘tslib’ cannot be found” · Issue #37991 · microsoft/TypeScript · GitHub

tsconfig.json中:

【Debug】此语法需要一个导入的帮助程序,但找不到模块“tslib”_第2张图片

{
  // ...rest of config
  "compilerOptions": {
    // ...rest of compiler options
    "baseUrl: ".",
    "paths": {
      "tslib" : ["path/to/node_modules/tslib/tslib.d.ts"]
    }
  }
}

你可能感兴趣的:(Debug,typescript)