From 3a8bcea840e1558faf1f06d4101f8c4179a02385 Mon Sep 17 00:00:00 2001 From: y0na24 Date: Tue, 19 May 2026 23:19:36 +0300 Subject: [PATCH] feat: add mutationOptions helper --- .changeset/rich-llamas-run.md | 5 +++++ src/index.ts | 1 + src/mutation-options.ts | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .changeset/rich-llamas-run.md create mode 100644 src/mutation-options.ts diff --git a/.changeset/rich-llamas-run.md b/.changeset/rich-llamas-run.md new file mode 100644 index 0000000..55061b6 --- /dev/null +++ b/.changeset/rich-llamas-run.md @@ -0,0 +1,5 @@ +--- +"mobx-tanstack-query": minor +--- + +add mutationOptions helper diff --git a/src/index.ts b/src/index.ts index 0a9ba28..ec2f952 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ export * from './inifinite-query.js'; export * from './inifinite-query.types.js'; export * from './mutation.js'; export * from './mutation.types.js'; +export * from './mutation-options.js'; export * from './query.js'; export * from './query.types.js'; export * from './query-client.js'; diff --git a/src/mutation-options.ts b/src/mutation-options.ts new file mode 100644 index 0000000..301412d --- /dev/null +++ b/src/mutation-options.ts @@ -0,0 +1,26 @@ +import type { DefaultError } from '@tanstack/query-core'; + +import type { MutationConfig } from './mutation.types.js'; + +export interface MutationOptionsParams< + TData = unknown, + TVariables = void, + TError = DefaultError, + TContext = unknown, +> extends Omit< + MutationConfig, + 'queryClient' + > {} + +export function mutationOptions< + TData = unknown, + TVariables = void, + TError = DefaultError, + TContext = unknown, +>( + options: MutationOptionsParams, +): MutationOptionsParams; + +export function mutationOptions(options: unknown) { + return options; +}