sindresorhus/p-queue

latest update causes all instances of `add` to return response | void

vidarc opened this issue · 5 comments

import PQueue from 'p-queue'

const queue = new PQueue();

// has type Promise<string | void>
const result = queue.add(() => 'testing');

I would initially expect result to have type of Promise<string>. This commit 8184655 seems to have changed that behavior.

If I'm reading the types correctly, doing

queue.add(() => 'testing', { throwOnTimeout: true })

should bring back the old typing, but it doesn't.

Added type tests

This is still occurring on 7.3.4. See BeeeQueue/dota-matches-api/actions/runs/4212473470/jobs/7311519688

The p-queue API could be improved. For now, pass throwOnTimeout: true as an option.

Still happening on the current release.