From 077230bf29dcc2d30aa426cff10d278667665e48 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 10:02:48 +0000 Subject: [PATCH] ci: apply automated fixes --- .../svelte/reference/functions/createQuery.md | 172 +++++++++--------- .../reference/functions/queryOptions.md | 4 +- .../type-aliases/DefinedInitialDataOptions.md | 2 +- .../UndefinedInitialDataOptions.md | 4 +- 4 files changed, 92 insertions(+), 90 deletions(-) diff --git a/docs/framework/svelte/reference/functions/createQuery.md b/docs/framework/svelte/reference/functions/createQuery.md index 52037bed90..d6a503566f 100644 --- a/docs/framework/svelte/reference/functions/createQuery.md +++ b/docs/framework/svelte/reference/functions/createQuery.md @@ -5,11 +5,96 @@ title: createQuery ## Call Signature +```ts +function createQuery(options: Accessor>, queryClient?: Accessor): DefinedCreateQueryResult; +``` + +Defined in: [packages/svelte-query/src/createQuery.ts:55](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/createQuery.ts#L55) + +Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. +The query runs when the options call for it — `enabled: false` skips the initial fetch. + +This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless +a `select` changes `TData` to include `undefined`). + +### Type Parameters + +#### TQueryFnData + +`TQueryFnData` = `unknown` + +#### TError + +`TError` = `Error` + +#### TData + +`TData` = `TQueryFnData` + +#### TQueryKey + +`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[] + +### Parameters + +#### options + +[`Accessor`](../type-aliases/Accessor.md)\<[`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>\> + +The [DefinedInitialDataOptions](../type-aliases/DefinedInitialDataOptions.md) to use — everything you can pass to `createQuery`, +with `initialData` set, wrapped in an [Accessor](../type-aliases/Accessor.md) so options can be reactive. + +#### queryClient? + +[`Accessor`](../type-aliases/Accessor.md)\<[`QueryClient`](../classes/QueryClient.md)\> + +Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will +be used. + +### Returns + +[`DefinedCreateQueryResult`](../type-aliases/DefinedCreateQueryResult.md)\<`TData`, `TError`\> + +The current query result, typed so that `status` is `success` — or `error` if a fetch attempt +fails while keeping the existing data (`status` never resolves to `pending` in this overload's type, +since `initialData` guarantees data upfront). `isSuccess`/`isError` are derived booleans for convenience. + +### See + +[queryOptions](queryOptions.md) to share these options between `createQuery` and imperative APIs like `queryClient.query`. + +### Example + +```svelte + + +{#if query.isError} + Error: {query.error.message} +{/if} +
    + {#each query.data as post (post.id)} +
  • {post.title}
  • + {/each} +
+``` + +## Call Signature + ```ts function createQuery(options: Accessor>, queryClient?: Accessor): CreateQueryResult; ``` -Defined in: [packages/svelte-query/src/createQuery.ts:77](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/createQuery.ts#L77) +Defined in: [packages/svelte-query/src/createQuery.ts:129](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/createQuery.ts#L129) Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. The query runs when the options call for it — `enabled: false` skips the initial fetch. @@ -111,91 +196,6 @@ The same query, checking `isPending`/`isError` instead of `status` — pick whic ## Call Signature -```ts -function createQuery(options: Accessor>, queryClient?: Accessor): DefinedCreateQueryResult; -``` - -Defined in: [packages/svelte-query/src/createQuery.ts:129](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/createQuery.ts#L129) - -Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. -The query runs when the options call for it — `enabled: false` skips the initial fetch. - -This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless -a `select` changes `TData` to include `undefined`). - -### Type Parameters - -#### TQueryFnData - -`TQueryFnData` = `unknown` - -#### TError - -`TError` = `Error` - -#### TData - -`TData` = `TQueryFnData` - -#### TQueryKey - -`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[] - -### Parameters - -#### options - -[`Accessor`](../type-aliases/Accessor.md)\<[`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>\> - -The [DefinedInitialDataOptions](../type-aliases/DefinedInitialDataOptions.md) to use — everything you can pass to `createQuery`, -with `initialData` set, wrapped in an [Accessor](../type-aliases/Accessor.md) so options can be reactive. - -#### queryClient? - -[`Accessor`](../type-aliases/Accessor.md)\<[`QueryClient`](../classes/QueryClient.md)\> - -Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will -be used. - -### Returns - -[`DefinedCreateQueryResult`](../type-aliases/DefinedCreateQueryResult.md)\<`TData`, `TError`\> - -The current query result, typed so that `status` is `success` — or `error` if a fetch attempt -fails while keeping the existing data (`status` never resolves to `pending` in this overload's type, -since `initialData` guarantees data upfront). `isSuccess`/`isError` are derived booleans for convenience. - -### See - -[queryOptions](queryOptions.md) to share these options between `createQuery` and imperative APIs like `queryClient.query`. - -### Example - -```svelte - - -{#if query.isError} - Error: {query.error.message} -{/if} -
    - {#each query.data as post (post.id)} -
  • {post.title}
  • - {/each} -
-``` - -## Call Signature - ```ts function createQuery(options: Accessor>, queryClient?: Accessor): CreateQueryResult; ``` diff --git a/docs/framework/svelte/reference/functions/queryOptions.md b/docs/framework/svelte/reference/functions/queryOptions.md index fc6270c8e3..47169cc898 100644 --- a/docs/framework/svelte/reference/functions/queryOptions.md +++ b/docs/framework/svelte/reference/functions/queryOptions.md @@ -9,7 +9,7 @@ title: queryOptions function queryOptions(options: DefinedInitialDataOptions): CreateQueryOptions & object & QueryKeyWithDataTag; ``` -Defined in: [packages/svelte-query/src/queryOptions.ts:69](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L69) +Defined in: [packages/svelte-query/src/queryOptions.ts:72](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L72) You can generally pass everything to `queryOptions` that you can also pass to `createQuery`. These options can be shared across `createQuery` calls and imperative APIs such as `queryClient.query`. `options.queryKey` @@ -88,7 +88,7 @@ The same options object, typed so that `queryKey` carries the inferred data type function queryOptions(options: UndefinedInitialDataOptions): CreateQueryOptions & object & QueryKeyWithDataTag; ``` -Defined in: [packages/svelte-query/src/queryOptions.ts:114](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L114) +Defined in: [packages/svelte-query/src/queryOptions.ts:117](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L117) You can generally pass everything to `queryOptions` that you can also pass to `createQuery`. These options can be shared across `createQuery` calls and imperative APIs such as `queryClient.query`. `options.queryKey` diff --git a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md index e45af352af..cae4be4150 100644 --- a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md @@ -7,7 +7,7 @@ title: DefinedInitialDataOptions type DefinedInitialDataOptions = CreateQueryOptions & object; ``` -Defined in: [packages/svelte-query/src/queryOptions.ts:19](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L19) +Defined in: [packages/svelte-query/src/queryOptions.ts:22](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L22) ## Type Declaration diff --git a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md index dd7717c471..b0ddb6cb6a 100644 --- a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md @@ -14,7 +14,9 @@ Defined in: [packages/svelte-query/src/queryOptions.ts:10](https://github.com/Ta ### initialData? ```ts -optional initialData: InitialDataFunction>; +optional initialData: + | InitialDataFunction> +| NonUndefinedGuard; ``` ## Type Parameters