Your API function
export const getUser = async (id: string) => ({ id, name: 'Ada' });TYPESCRIPT IN. REUSABLE OPTIONS OUT.
Generate type-safe TanStack Query v5 query, mutation and infinite-query option factories from existing TypeScript API functions. Explore real generated examples, watch mode and CI checks.
Explore generated code ↓Quick start guide ↗TanStack Query v5 · TypeScript · React 18 / 19 · MIT
01 / REAL GENERATOR OUTPUT
These examples are generated from this repository’s actual analyzer and code generator at build time. Select a function to inspect its source and output.
export const getUser = async (id: string) => ({ id, name: 'Ada' });import { getUser } from "./api";
import { queryOption as __rqh_query, infiniteOption as __rqh_infinite } from "@uiwwsw/react-query-helper";
export const getUserKey = ["users","api","getUser"] as const;
export const getUserQueryOption = __rqh_query(getUserKey, getUser);
export const getUserInfiniteQueryOption = __rqh_infinite(getUserKey, getUser);
This is a code-generation preview, not a live backend. Configure pagination and forward AbortSignal explicitly for your API.
02 / FROM INSTALL TO CI
Generate once, watch during development and check generated output in CI. Reuse factories with useQuery, prefetchQuery and cache reads.
npm install @uiwwsw/react-query-helper@^2 @tanstack/react-query react npx @uiwwsw/react-query-helper init npx @uiwwsw/react-query-helper generate npx @uiwwsw/react-query-helper watch npx @uiwwsw/react-query-helper generate --check
Typed query keys and query, mutation and infinite-query option factories from top-level TypeScript API functions. Keep your existing HTTP client. It does not replace TanStack Query caching or retries.
Configuration, pagination and migration ↗