Describe the bug
When using the factory queryOptions and exporting the result, TypeScript errors appear:
Exported variable 'shopsQuery' has or is using name 'dataTagErrorSymbol' from external module "/node_modules/@tanstack/query-core/build/legacy/hydration-DiTAi-4H" but cannot be named. (ts4023)
Exported variable 'shopsQuery' has or is using name 'dataTagSymbol' from external module "/node_modules/@tanstack/query-core/build/legacy/hydration-DiTAi-4H" but cannot be named. (ts4023)
These errors occur in every instance where I export the result of queryOptions. Removing the export resolves the issue, but that isn't an acceptable workaround.
Your minimal, reproducible example
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgRwK4FMoE8DyYbAQB2AznAL5wBmUEIcARAAIwCGpbAxgNYD0U6VpxgBaNJiwMAsAChZnYiXgKoA4QEUM2PAUVwAvCi258hUgAoEsuEYkBpdFgBccANoByFWpjuAugBpZcgBKWTCZdAAPSFg4BQ44YCIAN1YAG2AAE00JHTMyQ3FtU0VLa1tsB2c3dyTUjMy-QJkQoA
Steps to reproduce
- Install the latest version of @tanstack/react-query (v5.62.8).
- Create and export a variable using
queryOptions factory, e.g., export const shopsQuery = queryOptions(...);.
- Observe TypeScript errors as described.
Expected behavior
The queryOptions factory should allow exporting without triggering TypeScript errors.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
v5.62.8
TypeScript version
v5.7.2
Additional context
No response
Describe the bug
When using the factory
queryOptionsand exporting the result, TypeScript errors appear:These errors occur in every instance where I export the result of
queryOptions. Removing the export resolves the issue, but that isn't an acceptable workaround.Your minimal, reproducible example
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgRwK4FMoE8DyYbAQB2AznAL5wBmUEIcARAAIwCGpbAxgNYD0U6VpxgBaNJiwMAsAChZnYiXgKoA4QEUM2PAUVwAvCi258hUgAoEsuEYkBpdFgBccANoByFWpjuAugBpZcgBKWTCZdAAPSFg4BQ44YCIAN1YAG2AAE00JHTMyQ3FtU0VLa1tsB2c3dyTUjMy-QJkQoA
Steps to reproduce
queryOptionsfactory, e.g.,export const shopsQuery = queryOptions(...);.Expected behavior
The
queryOptionsfactory should allow exporting without triggering TypeScript errors.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
v5.62.8
TypeScript version
v5.7.2
Additional context
No response