Skip to content

Commit

Permalink
test: adapt test because we don't have the types limitation anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Oct 10, 2023
1 parent 216b31c commit 4695de8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/react-query/src/__tests__/useQuery.types.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ describe('initialData', () => {

it('it should be possible to define a different TData than TQueryFnData using select with queryOptions spread into useQuery', () => {
doNotExecute(() => {
const options = <TData = number,>(select?: (data: number) => TData) =>
queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve(1),
select,
})
const query = useQuery(options((data) => data > 1))
const options = queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve(1),
})

const query = useQuery({
...options,
select: (data) => data > 1,
})

const result: Expect<
Equal<boolean | undefined, (typeof query)['data']>
Expand Down

0 comments on commit 4695de8

Please sign in to comment.