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

报错如下:

在这里插入图片描述
代码可以编译运行,但是会有红线和报错。

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

tsconfig.json中:

在这里插入图片描述

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

猜你喜欢

转载自blog.csdn.net/karshey/article/details/134377251