Skip to content

MutationState type should be more specific, to allow narrowing to match useQuery #2601

@gavinwahl

Description

@gavinwahl

Conditionals on mutation status should narrow the type of data. For example,

mutation.status === 'success' && mutation.data

mutation.data can not be undefined after the guard, but the type doesn't reflect this. The object returned by useQuery does support narrowing like this, so useMutation should too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions