Skip to content

mutationFn is missing from UseMutationOptions type #2150

@Jeday

Description

@Jeday

Describe the bug
mutationFn is missing from declaration for UseMutationOptions. Preventing you from specifying mutation function in form of reusable config object similar to UseQueryOptions. Casting options object with mutationFn to any, bypassing type checks, code works fine and mutation function is called.

To Reproduce

In typescript project:

const mutation = useMutation({
    mutationFn: ()=>Promise.resolve(console.log('I am mutationFn'))
})

and run type checking.

Expected behavior
mutationFn should be an optional key in UseMutationOptions generic.

Desktop (please complete the following information):

  • any

Smartphone (please complete the following information):

  • any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions