Skip to content
Discussion options

You must be logged in to vote

sorry for your troubles. It compiles fine if you inline the function. You can then see that the inferred type is QueryFunctionContext, so if you use that to type it, it also works if you extract it to a function:

type Key = [string, { accountName?: string; token?: string }];

export const getCharacters = (
  params: QueryFunctionContext<Key>
): Promise<CharactersResponse> => { ... }

you can see that here: https://codesandbox.io/s/react-query-starting-point-forked-v7gc3?file=/src/App.tsx:268-370

Replies: 1 comment 1 reply

Comment options

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

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