From acb23d1d1e3f5ff1ce3452971ac7103c6a38326c Mon Sep 17 00:00:00 2001 From: Ben Bozzay Date: Thu, 11 Jan 2024 22:38:42 -0700 Subject: [PATCH] fix: typing generated for options parameter in the hooks method (#946) --- packages/plugins/tanstack-query/src/generator.ts | 6 +++--- packages/plugins/tanstack-query/src/runtime-v5/svelte.ts | 4 ++-- packages/plugins/tanstack-query/src/runtime/svelte.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugins/tanstack-query/src/generator.ts b/packages/plugins/tanstack-query/src/generator.ts index 1e39253fc..c32799cbc 100644 --- a/packages/plugins/tanstack-query/src/generator.ts +++ b/packages/plugins/tanstack-query/src/generator.ts @@ -569,7 +569,7 @@ function makeBaseImports(target: TargetFramework, version: TanStackVersion) { case 'svelte': return [ `import { derived } from 'svelte/store';`, - `import type { MutationOptions, QueryOptions, CreateInfiniteQueryOptions } from '@tanstack/svelte-query';`, + `import type { MutationOptions, CreateQueryOptions, CreateInfiniteQueryOptions } from '@tanstack/svelte-query';`, ...(version === 'v5' ? [`import type { InfiniteData, StoreOrVal } from '@tanstack/svelte-query';`] : []), @@ -597,8 +597,8 @@ function makeQueryOptions(target: string, returnType: string, infinite: boolean, ? `Omit, 'queryKey'>` : `StoreOrVal>, 'queryKey'>>` : version === 'v4' - ? `Omit, 'queryKey'>` - : `StoreOrVal, 'queryKey'>>`; + ? `Omit, 'queryKey'>` + : `StoreOrVal, 'queryKey'>>`; default: throw new PluginError(name, `Unsupported target: ${target}`); } diff --git a/packages/plugins/tanstack-query/src/runtime-v5/svelte.ts b/packages/plugins/tanstack-query/src/runtime-v5/svelte.ts index 706c6ef8f..d01ed02e4 100644 --- a/packages/plugins/tanstack-query/src/runtime-v5/svelte.ts +++ b/packages/plugins/tanstack-query/src/runtime-v5/svelte.ts @@ -8,8 +8,8 @@ import { type InfiniteData, type MutationOptions, type StoreOrVal, + type CreateQueryOptions, } from '@tanstack/svelte-query-v5'; -import { QueryOptions } from '@tanstack/vue-query'; import { ModelMeta } from '@zenstackhq/runtime/cross'; import { getContext, setContext } from 'svelte'; import { Readable, derived } from 'svelte/store'; @@ -62,7 +62,7 @@ export function useModelQuery( model: string, url: string, args?: unknown, - options?: StoreOrVal, 'queryKey'>>, + options?: StoreOrVal, 'queryKey'>>, fetch?: FetchFn, optimisticUpdate = false ) { diff --git a/packages/plugins/tanstack-query/src/runtime/svelte.ts b/packages/plugins/tanstack-query/src/runtime/svelte.ts index d87ca304c..84a175f58 100644 --- a/packages/plugins/tanstack-query/src/runtime/svelte.ts +++ b/packages/plugins/tanstack-query/src/runtime/svelte.ts @@ -6,7 +6,7 @@ import { useQueryClient, type CreateInfiniteQueryOptions, type MutationOptions, - type QueryOptions, + type CreateQueryOptions, } from '@tanstack/svelte-query'; import { ModelMeta } from '@zenstackhq/runtime/cross'; import { getContext, setContext } from 'svelte'; @@ -59,7 +59,7 @@ export function useModelQuery( model: string, url: string, args?: unknown, - options?: Omit, 'queryKey'>, + options?: Omit, 'queryKey'>, fetch?: FetchFn, optimisticUpdate = false ) {