Could someone please help me understand why I am getting an error with this code?
var promise = new Promise((resolve, reject) => {
resolve([1, 2, 3, 4, 5]);
});
async function doSomethingAsync() {
var data = await promise;
data.forEach(v => console.log(v));
}
doSomethingAsync();
When attempting to compile this using tsc file.ts --target ES6, I encounter the following issue:
error:async.ts(7,10): error TS2339: Property 'forEach' does not exist on type '{}'.