* fix(query-core): use built-in NoInfer to support generic indexed-access types
The local `NoInfer<T> = [T][T extends any ? 0 : never]` trick breaks down
when `T` is a generic indexed-access type such as `DataTypeToEntity[DT]`,
producing errors like "Type '[DataTypeToEntity[DT]]' is not assignable to
type 'DataTypeToEntity'".
Since the project already requires TypeScript >= 5.4, delegate the public
`NoInfer<T>` alias to TypeScript's built-in `NoInfer` (introduced in 5.4).
A small `noInfer.ts` helper exposes it as `IntrinsicNoInfer<T>` to avoid
the local-shadow recursion problem.
Vue's `setQueryData` implementation now forwards the `<TData>` generic to
`super.setQueryData<TData>(...)` so its declared `NoInfer<TData> | undefined`
return type stays satisfied under the stricter built-in `NoInfer`.
Fixes#9937
* test(react-query): move 'generic indexed access TData' describe out of 'initialData'
Block was nested inside `describe('initialData', ...)` but is unrelated
to initialData behavior. Lift it to sibling level under
`describe('useQuery', ...)` so test output groups it correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test(react-query): document implicit regression guard for generic indexed-access NoInfer
Per CodeRabbit nitpick: clarify that the `getLabel(props.dataType, data)` call
itself is the regression guard. With the previous hand-rolled NoInfer, this
call failed to type-check; with built-in NoInfer (TS 5.4+), it compiles.
An explicit `expectTypeOf(data).toEqualTypeOf<...>()` / `toMatchTypeOf<...>()`
cannot work here — vitest's type-relation checks reduce to
`Extends<NoInfer<T>, T>` which TS leaves unresolved under a generic
`TDataType extends DataType` constraint.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(query-core): drop NoInfer re-export, use built-in everywhere
Per @TkDodo's review: TypeScript's intrinsic NoInfer (TS ≥ 5.4) is the
canonical type, and the package already requires TS ≥ 5.4. Removing the
re-export sidesteps the self-shadowing issue entirely and avoids
encouraging consumers to import a duplicate.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
* fix(eslint-plugin-query): handle array-destructured useQueries results in no-unstable-deps
The `collectVariableNames` function in the `no-unstable-deps` rule only
handled `Identifier` patterns. When users array-destructure `useQueries`
or `useSuspenseQueries` results (e.g. `const [q1, q2] = useQueries(...)`),
the individual variables were not tracked as unstable. This meant passing
them directly to React hook dependency arrays was never flagged.
Extend `collectVariableNames` to also handle `ArrayPattern` — including
plain identifier elements and rest elements.
Fixes#10746
* ci: apply automated fixes
---------
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* test(query-devtools/Explorer): add tests for inline edit on primitive rows
* test(query-devtools/Explorer): explicitly provide 'valueAsNumber' in change event payload
* fix(vue-query): allow computed ref as queryKey property in queryOptions
Closes#10525
* fix(vue-query): widen queryKey to MaybeRefOrGetter to match enabled
toValueDeep already calls `() => T` at runtime, so the queryKey type
should accept the same reactive forms as enabled: Ref, ComputedRef,
and getters. Adds a getter test and updates the changeset.
---------
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: Damian Osipiuk <osipiukd+git@gmail.com>
* test(query-devtools/Devtools): add test for clamping the width when resizing below min width
* ci: apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* test(query-devtools/Devtools): add tests for online toggle
* test(query-devtools/Devtools): remove redundant 'should set "onlineManager" offline' covered by label swap test
* test(query-devtools/Devtools): add tests for resize handle
* test(query-devtools/Devtools): assert 'panel' is 'HTMLElement' instead of 'not.toBeNull' for stronger 'getBoundingClientRect' guarantee
* test(query-devtools/Devtools): assert non-null before parsing 'localStorage' value to prevent 'Number(null) === 0' false positive in decrease assertions
* test(query-devtools/Devtools): add tests for settings menu
* ci: apply automated fixes
* test(query-devtools/Devtools): fail fast with 'expect' instead of conditional guards on selector lookups
* test(query-devtools/Devtools): coerce 'el.textContent' to string for 'TS18047' under strict 'vue-tsc' build
* test(query-devtools/Devtools): remove redundant 'should render the settings button' covered by other settings menu tests
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* test(query-devtools/Devtools): add tests for query list rendering, filtering, and status indicators
* test(query-devtools/Devtools): use 'some' to find 'CLEAR_MUTATION_CACHE' event in dispatched calls
* test(query-devtools/Devtools): use 'vi.useFakeTimers' and 'vi.advanceTimersByTimeAsync' for microtask flush
* test(query-devtools/Devtools): assert tooltip visibility on hover/focus instead of badge presence