Skip to content

TVariables default Type #8751

@hossein-jorfi

Description

@hossein-jorfi

Shouldn't TVariables default be "any" or "unknown" so you dont have to define it unless its important to you to be defined

that is just because if you write:


  const { mutate } = useMutation((values) =>

    axios.post('/test', values),

  );

it is not defined what values should have for a type. The generic TVariables defaults to void and that's the error you are getting. If you write a function in typescript:


const myFunction = (variables) => console.log(variables)

the compiler needs to know what variables will be, otherwise, it will be implicitly any.

if you take my example where values has a type of values: Variables, you will see that it works.

Originally posted by @TkDodo in #2134

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