Skip to content

Commit

Permalink
refactor(svelte-query): specify StoreOrVal in function signature (#7453)
Browse files Browse the repository at this point in the history
Co-authored-by: Lachlan Collins <[email protected]>
  • Loading branch information
ap0nia and lachlancollins authored Jul 8, 2024
1 parent d2a92d9 commit 2df92a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/svelte-query/src/createMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
CreateMutateFunction,
CreateMutationOptions,
CreateMutationResult,
StoreOrVal,
} from './types'
import type { DefaultError, QueryClient } from '@tanstack/query-core'

Expand All @@ -15,7 +16,9 @@ export function createMutation<
TVariables = void,
TContext = unknown,
>(
options: CreateMutationOptions<TData, TError, TVariables, TContext>,
options: StoreOrVal<
CreateMutationOptions<TData, TError, TVariables, TContext>
>,
queryClient?: QueryClient,
): CreateMutationResult<TData, TError, TVariables, TContext> {
const client = useQueryClient(queryClient)
Expand Down
8 changes: 3 additions & 5 deletions packages/svelte-query/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ export type CreateMutationOptions<
TError = DefaultError,
TVariables = void,
TContext = unknown,
> = StoreOrVal<
OmitKeyof<
MutationObserverOptions<TData, TError, TVariables, TContext>,
'_defaulted'
>
> = OmitKeyof<
MutationObserverOptions<TData, TError, TVariables, TContext>,
'_defaulted'
>

export type CreateMutateFunction<
Expand Down

0 comments on commit 2df92a6

Please sign in to comment.