Skip to content
Source
Sign inSign up
TanStack/query

fix(solid-query): export `queryOptions` without type errors #9668

MergedZen-cronic(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/9668/headmerged by TkDodo View on GitHub

Showing 2 changed files with 16 additions and 13 deletions.

x
0 of 2 viewed, 2 left
14 additions and 1 deletionpackages/solid-query/src/__tests__/queryOptions.test-d.tsxModified
View file
@@ -1,5 +1,10 @@
import { assertType, describe, expectTypeOf, it } from 'vitest'
-import { QueryClient, dataTagSymbol, skipToken } from '@tanstack/query-core'
+import {
+ QueryClient,
+ dataTagErrorSymbol,
+ dataTagSymbol,
+ skipToken,
+} from '@tanstack/query-core'
import { useQuery } from '../useQuery'
import { queryOptions } from '../queryOptions'
​
@@ -74,6 +79,14 @@
​
expectTypeOf(queryKey[dataTagSymbol]).toEqualTypeOf<number>()
})
+ it('should tag the queryKey with the default error type', () => {
+ const { queryKey } = queryOptions({
+ queryKey: ['key'],
+ queryFn: () => Promise.resolve(1),
+ })
+​
+ expectTypeOf(queryKey[dataTagErrorSymbol]).toEqualTypeOf<Error>()
Thread on line 88

before the fix, this was typeof unsetMarker which ts treated as an "inaccessible unique symbol"