A promise's then or catch handler is allowed to return a promise itself; that promise is automatically awaited before invoking the next then or catch in the chain. However, workerpool's types did not reflect this: as a result, promise chains could end up with types like Promise<Promise<number, Error>, any>.
A promise's
then
orcatch
handler is allowed to return a promise itself; that promise is automatically awaited before invoking the nextthen
orcatch
in the chain. However, workerpool's types did not reflect this: as a result, promise chains could end up with types likePromise<Promise<number, Error>, any>
.