Whenever I execute the post()
function below, it triggers an error message stating:
Type 'void' must have a '[Symbol.iterator]()' method that returns an iterator.
This is the code snippet causing the issue:
static async post(options:object) {
const promise = postRequest(options)
const [err, data] = await this.promiseWapper(promise);
return [err, data]
}
static async promiseWapper(promise: any) {
return
promise()
.then((res: any) => [undefined, res])
.catch((err: any) => [err, undefined])
}
Is there a way to rectify these errors in order to successfully run the code?