There is an issue with the typing when using boss.work with batchSize.
As the documentations say, and as the tests files show, when using batchSize in work options, we should provide a work handler that accept an array of jobs as argument.
error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(jobs: Job<Foo>[]) => Promise<void>' is not assignable to parameter of type 'WorkHandler<unknown>'.
Types of parameters 'jobs' and 'job' are incompatible.
Type 'Job<unknown>' is missing the following properties from type 'Job<Foo>[]': length, pop, push, concat, and 29 more.
The typing misses some overloads to handle this case.
Hello @timgit,
There is an issue with the typing when using
boss.work
withbatchSize
.As the documentations say, and as the tests files show, when using batchSize in work options, we should provide a work handler that accept an array of jobs as argument.
But when doing this in TS, there is an error.
The typing misses some overloads to handle this case.
I prepare a PR.
Cheers.