Skip to content

Commit d8e00a7

Browse files
fix(vue-query): export queryOptions support types (#11042)
Re-export the helper types that the public queryOptions signature depends on but that were unreachable from the package roots: ShallowOption and MaybeRefOrGetter from @tanstack/vue-query, and QueryBehavior, RetryValue, RetryDelayValue from @tanstack/query-core. The declaration-emit / name collision core of #11042 was already fixed by #11224; this completes the remaining unexported-supporting-types part. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 32ca5b5 commit d8e00a7

5 files changed

Lines changed: 41 additions & 1 deletion

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@tanstack/query-core': patch
3+
'@tanstack/vue-query': patch
4+
---
5+
6+
fix(vue-query): export the helper types referenced by `queryOptions`
7+
8+
Re-export from the package roots the supporting types that the public
9+
`queryOptions` signature depends on but that were previously unreachable:
10+
`ShallowOption` and `MaybeRefOrGetter` from `@tanstack/vue-query`, and
11+
`QueryBehavior`, `RetryValue` and `RetryDelayValue` from `@tanstack/query-core`.
12+
This lets downstream libraries name the inferred `queryOptions` return type in
13+
their emitted declarations (#11042).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { describe, expectTypeOf, it } from 'vitest'
2+
import type { QueryBehavior, RetryDelayValue, RetryValue } from '..'
3+
4+
// Regression for #11042: the types referenced by the public `queryOptions`
5+
// signature must be reachable from the package root, otherwise downstream
6+
// declaration emit cannot name them.
7+
describe('public type exports', () => {
8+
it('re-exports retry and behavior helper types from the package root', () => {
9+
expectTypeOf<RetryValue<Error>>().not.toBeNever()
10+
expectTypeOf<RetryDelayValue<Error>>().not.toBeNever()
11+
expectTypeOf<QueryBehavior>().not.toBeNever()
12+
})
13+
})

‎packages/query-core/src/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export type { QueryCacheNotifyEvent } from './queryCache'
2323
export { QueryClient } from './queryClient'
2424
export { QueryObserver } from './queryObserver'
2525
export { CancelledError, isCancelledError } from './retryer'
26+
export type { RetryDelayValue, RetryValue } from './retryer'
27+
export type { QueryBehavior } from './query'
2628
export {
2729
timeoutManager,
2830
type ManagedTimerId,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { describe, expectTypeOf, it } from 'vitest'
2+
import type { MaybeRefOrGetter, ShallowOption } from '..'
3+
4+
// Regression for #11042: the vue-query helper types referenced by the public
5+
// `queryOptions` signature must be reachable from the package root so that
6+
// downstream declaration emit can name them.
7+
describe('public type exports', () => {
8+
it('re-exports vue-query helper types from the package root', () => {
9+
expectTypeOf<ShallowOption>().not.toBeNever()
10+
expectTypeOf<MaybeRefOrGetter<number>>().not.toBeNever()
11+
})
12+
})

‎packages/vue-query/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type {
3939
UseInfiniteQueryReturnType,
4040
} from './useInfiniteQuery'
4141
export type { UseMutationOptions, UseMutationReturnType } from './useMutation'
42-
export type { MutationOptions } from './types'
42+
export type { MaybeRefOrGetter, MutationOptions, ShallowOption } from './types'
4343
export type { UseQueriesOptions, UseQueriesResults } from './useQueries'
4444
export type {
4545
MutationStateOptions,

0 commit comments

Comments
 (0)