import { DefaultError, WithRequired } from '@tanstack/query-core'; import { CreateMutationOptions } from './types.js'; /** * Allows to share and re-use mutation options in a type-safe way. * * **Example** * * ```ts * export class QueriesService { * private http = inject(HttpClient) * private queryClient = inject(QueryClient) * * updatePost(id: number) { * return mutationOptions({ * mutationFn: (post: Post) => Promise.resolve(post), * mutationKey: ["updatePost", id], * onSuccess: (newPost) => { * // ^? newPost: Post * this.queryClient.setQueryData(["posts", id], newPost) * }, * }); * } * } * * class ComponentOrService { * queries = inject(QueriesService) * id = signal(0) * mutation = injectMutation(() => this.queries.updatePost(this.id())) * * save() { * this.mutation.mutate({ title: 'New Title' }) * } * } * ``` * @param options - The mutation options. * @returns Mutation options. */ export declare function mutationOptions(options: WithRequired, 'mutationKey'>): WithRequired, 'mutationKey'>; export declare function mutationOptions(options: Omit, 'mutationKey'>): Omit, 'mutationKey'>;