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
我正在尝试针对较旧的浏览器,并且我相信需要支持。我认为这可以通过转译/polyfilling来完成?我的打字稿配置是:
{
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"declaration": true,
"removeComments": false,
"module" : "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
},
"include": [
"src/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}