I'm currently using VS2017 and TypeScript 2.5.3.
The .ts code I'm working with is as follows:
class LossEnergyCalculation {
async initLossEnergyCalculation(): Promise<void> {
try {
const response = await fetch("/LossEnergyCalculation/GetOilFieldList");
const oilFieldsData = await response.json();
}
...
}
In the project's properties under the TypeScript Build section, I have configured it as follows:
TypeScript version: 2.5
ECMAScript version: ECMAScript 5
JSX compilation in TSX files: None
Module System: CommonJS
I do not have a tsconfig.json file in this project.
When I try to build the project, I encounter the following error message:
Build:An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
Any suggestions on how to resolve this error would be greatly appreciated.