Open adam-arold opened 2 years ago
I tried to reduce this and it seems that the problem is the async
function. This fails:
try {
// start worker pool
await start();
// this function will be executed in another thread
const res = await job(async () => {
return 1;
});
console.log(res);
} catch (err) {
console.error(err);
}
while this successfully returns 1
:
try {
// start worker pool
await start();
// this function will be executed in another thread
const res = await job(() => {
return 1;
});
console.log(res);
} catch (err) {
console.error(err);
}
I tried looking up the error message but all I found were 2 GitHub issues that were unactionable and closed. Do you have a working example with typescript?
When I try to run the example using typescript:
I get:
If I run the code from javascript it works. Is there a solution for this? ☝️