Currently, user must always copy/paste { throwOnTimeout: true } in each and every .add() call otherwise they end up with void in their typings:
import Queue from "p-queue"
const queue = new Queue({
concurrency: 1,
interval: 1500,
intervalCap: 1,
throwOnTimeout: true, // regardless of this
})
// typed as number | void
const value1 = await queue.add(async () => 123)
// typed as number
const value2 = await queue.add(async () => 123, { throwOnTimeout: true })
Can we please have some way to reduce this boilerplate? Either extend class typings to lookup the init options, or add a shortcut method such as queue.execute (?) which will do { throwOnTimeout: true } on its own.
Currently, user must always copy/paste
{ throwOnTimeout: true }
in each and every.add()
call otherwise they end up withvoid
in their typings:Can we please have some way to reduce this boilerplate? Either extend class typings to lookup the init options, or add a shortcut method such as
queue.execute
(?) which will do{ throwOnTimeout: true }
on its own.