Skip to content

Commit

Permalink
test: from #8691
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Feb 25, 2025
1 parent 06414eb commit 3a84e05
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/query-core/src/__tests__/queryClient.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,25 @@ describe('fully typed usage', () => {
})

describe('invalidateQueries', () => {
it('shows type error when queryKey is a wrong type in invalidateQueries', () => {
const queryClient = new QueryClient()

queryClient.invalidateQueries()

queryClient.invalidateQueries({
queryKey: ['1'],
})

queryClient.invalidateQueries({
// @ts-expect-error
queryKey: '1',
})

queryClient.invalidateQueries({
// @ts-expect-error
queryKey: {},
})
})
it('predicate should be typed if key is tagged', () => {
const queryKey = ['key'] as DataTag<Array<string>, number>
const queryClient = new QueryClient()
Expand Down

0 comments on commit 3a84e05

Please sign in to comment.