Skip to content

SolidJS + Solid (Tanstack) Query type requires fields in mutate that are already provided by createMutation #1627

Open
@mezuzza

Description

@mezuzza

Description

I'm using solid js, openapi-ts, and solid-query together. Obviously not the most common stack in the world, but I'm running into a small problem. The api takes both a path parameter (id) and a body with two fields. All are required. When I create the API and provide the path parameter up front while inserting the body parameters later, typescript fails.

  const clearData = createMutation(() => ({
    ...clearDataMutation({
      path: {
        id: params.id,
      },
    }),
    onSuccess: (data) => {
      queryClient.setQueryData(queryKey, updater);
    },
  }));

  clearData.mutate({ // is not assignable to parameter of type 'Options<ClearDataData>'. Property 'path' is missing in type ...
    body: {
        field1: 1,
        field2: 2,
    },
  });

The provided fields need to be excluded or made optional from the signature of the mutate method.

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example

OpenAPI specification (optional)

No response

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't workingneeds info ⏳Further information is required

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions