Promise.all<any, any>(ajaxRequests).then(()=> {
console.log("done");
});
上面的代码给出了以下编译器错误:
TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
我不熟悉此编译器lib
选项的含义,以及如果我要对其进行更改的含义。
我正在尝试针对较旧的浏览器,并且需要支持es5
。我认为这可以通过转储/填充来完成?我的打字稿配置是:
{
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"declaration": true,
"removeComments": false,
"module" : "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
},
"include": [
"src/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}