Skip to content
Discussion options

You must be logged in to vote

Hi @bennettdams, afraid this is indeed a bug in the types.

Short term

I've added a workaround example to your sandbox: res5 and res6 - https://codesandbox.io/s/lingering-firefly-mb8wgm?file=/src/App.tsx

res5 (copied below) => you can get the types to work by providing the signal type explicitly.

  // ✅ useQueries with signal explicitly typed
  const res5 = useQueries({
    queries: ["bar"].map((todoId) => ({
      queryKey: ["foo", todoId],
      queryFn: async ({ signal }: { signal?: AbortSignal }) =>
        await fetchTodo(todoId, signal)
    }))
  });

res6 => you still get type checking, in the sense that if you give your signal the wrong type e.g. { signal?: string }, it will complai…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@bennettdams
Comment options

Answer selected by bennettdams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants