Skip to content

TVariables default Type #8751

Closed
Closed

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

Activity

  1. locked and limited conversation to collaborators on Mar 4, 2025
  2. converted this issue into a discussion #8752 on Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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