仅当 “module” 选项设置为 “esnext” 或 “system”,并且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “await” 表达式。ts(1378)

{
  "compileOnSave": true,
  "compilerOptions": {
    "moduleResolution": "node",
    "alwaysStrict": true,
    "charset": "utf8",
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "inlineSourceMap": true,
    "module": "esnext", // 修改 commonjs -- esnext
    "newLine": "lf",
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": false,
    "noImplicitThis": true,
    "noUnusedLocals": false,
    "outDir": "dist",
    "pretty": true,
    "skipLibCheck": true,
    "strict": true,
    "strictPropertyInitialization": false,
    "stripInternal": true,
    "importHelpers": true,
    "target": "ES2018"
  },
  "exclude": [
    "app/public",
    "app/views",
    "dist",
    "node_modules",
    "test"
  ]
}


Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐