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 breaks when using useSuspenseQueries with spreaded queryOptions #8708

Closed
gs18004 opened this issue Feb 26, 2025 · 0 comments · Fixed by #8709
Closed

type breaks when using useSuspenseQueries with spreaded queryOptions #8708

gs18004 opened this issue Feb 26, 2025 · 0 comments · Fixed by #8709

Comments

@gs18004
Copy link
Contributor

gs18004 commented Feb 26, 2025

Describe the bug

thanks to @jeremiasjutz
The type error is shown when we use useSuspenseQueries with spreaded queryOptions.

function myQueryOptions() {
    return queryOptions({
      queryKey: ['key1'],
      queryFn: () => 'Query Data',
    })
  }
  useSuspenseQueries({
    queries: [
      {
        ...myQueryOptions(),
        select(data: string) {
          return data
        },
      },
    ],
  })
}

Your minimal, reproducible example

Steps to reproduce

Write the code on your text editor.
The type error will be shown.

Expected behavior

The type error should not be shown.
Also, the type of select function should be inferred.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

macOS
VS Code

Tanstack Query adapter

None

TanStack Query version

5.66.9

TypeScript version

No response

Additional context

No response

@gs18004 gs18004 changed the title type breaks when using useSuspenseQueries with spreaded queryOptions type breaks when using spreaded queryOptions Feb 26, 2025
@gs18004 gs18004 changed the title type breaks when using spreaded queryOptions type breaks when using useSuspenseQueries with spreaded queryOptions Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant