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

前端 未结 4 1826
走了就别回头了
走了就别回头了 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:42

    Adding

    "lib": [ "es2015" ]
    

    to tsconfig.json should fix the issue. However it seems that your spec files are not included in your tsconfig.json (check "include":[] and "exclude":[] values). So the Typescript service must be using a different tsconfig.json for your files (may be a default one, if no tsconfig.json files that include your specs can be found) To fix the issue, make sure to specify the lib property in config that is used for your spec files processing

提交回复
热议问题