Skip to content

API reference > @kontsedal/olas-core > MutationRun

MutationRun type ​

Call signature for mutation.run: - When V is void → no args. (mutation.run()) - When V was not constrained (default-inferred as unknown) → optional arg. Lets createMutation(ctx, { mutate: async () => 1 }) call run() *or* run(anything) without a type error. - Otherwise → arg required. (mutation.run(vars))

Defined as a variadic-tuple conditional so consumers see the right shape without writing run(undefined as unknown as void).

Signature:

typescript
type MutationRun<V, R> = (...args: unknown extends V ? [V?] : [V] extends [void] ? [] : [V]) => Promise<R>;

Released under the MIT License.