Skip to content
Source
Sign inSign up
TanStack/query

type breaks when using useSuspenseQueries with spreaded queryOptions #8708

Send to my agent
Closedgs18004(GitHub profile, opens in a new tab) opened this issue 0 comments

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

  1. gs18004(GitHub profile, opens in a new tab) changed the title

  2. gs18004(GitHub profile, opens in a new tab) changed the title

  3. TkDodo closed this

Sign in to join this conversation.