I am currently working with a function that returns a promise of an array:
async function functionReturningPromiseOfUserIDs(): Promise<string[]>
My question is, can I use the forEach method on the array returned by this function?
async function runForEachUser() {
await functionReturningPromiseOfUserIDs().forEach((userID: string) => {
return userID; // do stuff with userID
}
}
When I try to do this in TypeScript, it gives me this error:
Property 'forEach' does not exist on type '() => Promise<string[]>'.ts(2339)