-
| BackgroundI'm migrating from v4 to v5 and discovered that the  The IssueAccording to the v5 migration guide, the experimental  However, I found that the  ❌ This fails at compile time (as expected):useQuery({
  queryKey: ['example'],
  queryFn: fetchData,
  suspense: true, // ❌ TypeScript error
})✅ But this works at both compile time AND runtime:const options = { 
  suspense: true,
  queryKey: ['example'],
  queryFn: fetchData,
}
useQuery(options) // ✅ No TypeScript error, works at runtimeOr using spread: const baseOptions = { suspense: true }
useQuery({
  queryKey: ['example'],
  queryFn: fetchData,
  ...baseOptions, // ✅ TypeScript doesn't catch this
})Why This WorksLooking at the source code: 
 Questions
 Workaround for Large MigrationsFor teams migrating large codebases, this pattern could be useful as a temporary bridge: // Centralized query options factory
function createQueryOptions<T>(options: QueryOptions<T>) {
  return {
    ...options,
    suspense: true, // Temporarily until we migrate to useSuspenseQuery
  }
}
// Usage
useQuery(createQueryOptions({
  queryKey: ['example'],
  queryFn: fetchData,
}))Environment
 Would appreciate any guidance on whether this is a known issue or if there are better migration strategies! 🙏 | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| it’s removed from types so use at your own risk. | 
Beta Was this translation helpful? Give feedback.
it’s removed from types so use at your own risk.