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

type issue when Promise<void> is returned #3516

Closed
TkDodo opened this issue Apr 15, 2022 · 0 comments
Closed

type issue when Promise<void> is returned #3516

TkDodo opened this issue Apr 15, 2022 · 0 comments

Comments

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 15, 2022

returning undefined is illegal in v4 and should be flagged on typescript level. However, this fails is a Promise of undefined is returned, e.g. via async () => undefined. Also, it doesn't work for useQueries. Status quo:

useQuery(key, () => undefined) errors, as expected ✅
useQuery(key, async () => undefined) no error ❌
useQueries({ queries: [{ queryKey: key, queryFn: () => undefined }]}) no error ❌
useQueries({ queries: [{ queryKey: key, queryFn: async () => undefined }]}) no error ❌

@artysidorenko fyi, as discussed

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

No branches or pull requests

1 participant