Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/export-queryoptions-support-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@tanstack/query-core': patch
'@tanstack/vue-query': patch
---

fix(vue-query): export the helper types referenced by `queryOptions`

Re-export from the package roots the supporting types that the public
`queryOptions` signature depends on but that were previously unreachable:
`ShallowOption` and `MaybeRefOrGetter` from `@tanstack/vue-query`, and
`QueryBehavior`, `RetryValue` and `RetryDelayValue` from `@tanstack/query-core`.
This lets downstream libraries name the inferred `queryOptions` return type in
their emitted declarations (#11042).
13 changes: 13 additions & 0 deletions packages/query-core/src/__tests__/publicTypeExports.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { describe, expectTypeOf, it } from 'vitest'
import type { QueryBehavior, RetryDelayValue, RetryValue } from '..'

// Regression for #11042: the types referenced by the public `queryOptions`
// signature must be reachable from the package root, otherwise downstream
// declaration emit cannot name them.
describe('public type exports', () => {
it('re-exports retry and behavior helper types from the package root', () => {
expectTypeOf<RetryValue<Error>>().not.toBeNever()
expectTypeOf<RetryDelayValue<Error>>().not.toBeNever()
expectTypeOf<QueryBehavior>().not.toBeNever()
})
})
2 changes: 2 additions & 0 deletions packages/query-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export type { QueryCacheNotifyEvent } from './queryCache'
export { QueryClient } from './queryClient'
export { QueryObserver } from './queryObserver'
export { CancelledError, isCancelledError } from './retryer'
export type { RetryDelayValue, RetryValue } from './retryer'
export type { QueryBehavior } from './query'
export {
timeoutManager,
type ManagedTimerId,
Expand Down
12 changes: 12 additions & 0 deletions packages/vue-query/src/__tests__/publicTypeExports.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, expectTypeOf, it } from 'vitest'
import type { MaybeRefOrGetter, ShallowOption } from '..'

// Regression for #11042: the vue-query helper types referenced by the public
// `queryOptions` signature must be reachable from the package root so that
// downstream declaration emit can name them.
describe('public type exports', () => {
it('re-exports vue-query helper types from the package root', () => {
expectTypeOf<ShallowOption>().not.toBeNever()
expectTypeOf<MaybeRefOrGetter<number>>().not.toBeNever()
})
})
2 changes: 1 addition & 1 deletion packages/vue-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type {
UseInfiniteQueryReturnType,
} from './useInfiniteQuery'
export type { UseMutationOptions, UseMutationReturnType } from './useMutation'
export type { MutationOptions } from './types'
export type { MaybeRefOrGetter, MutationOptions, ShallowOption } from './types'
export type { UseQueriesOptions, UseQueriesResults } from './useQueries'
export type {
MutationStateOptions,
Expand Down