Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vidarc opened this issue Feb 6, 2023 · 4 comments
Closed

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

vidarc opened this issue Feb 6, 2023 · 4 comments

Comments

@vidarc
Copy link

vidarc commented Feb 6, 2023

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.

@sindresorhus
Copy link
Owner

// @Richienb

@Richienb
Copy link
Collaborator

Richienb commented Feb 7, 2023

Added type tests

@BeeeQueue
Copy link

@Richienb
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants