WebStorm, An async function or method in ES5/ES3 requires the 'Promise' constructor

前端 未结 4 1821
走了就别回头了
走了就别回头了 2021-01-17 12:39

I try to write tests in typescript (ES6) using WebStorm IDE. E.g.:

// Imports...

describe(\'Message\', () => {
    const server = express();
    serv         


        
4条回答
  •  时光取名叫无心
    2021-01-17 12:43

    {
      "compilerOptions": {
        "module": "commonjs",
        "declaration": true,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false,
        "allowSyntheticDefaultImports": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es6",
        "sourceMap": true,
        "outDir": "./dist",
        "baseUrl": "./src",
        "lib": ["es2015"]
      },
      "include": [
        "src/**/*",
        "**/*.spec.ts"
      ],
      "exclude": [
        "node_modules"
      ]
    }
    

    adding "lib":["es2015"] to "compilerOptions" as per @lena's answer and Removing **/*.spec.ts from "exclude":[] and adding it to "include":[] solved it for me.

提交回复
热议问题