Skip to content

Return type of useSendUserOperation is inconsistent with useMutation return type #6

@freeatnet

Description

@freeatnet

Steps to reproduce:

  1. Use useSendUserOperation hook.
  2. Inspect result.data in a branch where result.isSuccess is true.

Expected: based on original react-query types, when isSuccess is true, data should have TData type.
Observed: data is TData | undefined.

Same issue applies to isError and error.

Quick triage suggests original types get mangled by Omit<UseMutationResult<…>, 'mutate'>. Wagmi seems to use a custom UnionOmit utility type to deal with the same problem.

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