Skip to content

TypeScript error: ConvexClient.mutation method signature inconsistency #23

@NazCodeland

Description

@NazCodeland

The method signature documentation shows a third options parameter, but the implementation only accepts two parameters.

// This causes a TypeScript error
await client.mutation(
  api.mutations.resetChangedFlags, 
  {
    ids: query.data.map((entry) => entry._id)
  },
  { /* options */ }
);

Error message I'm seeing:

Expected 2 arguments, but got 3.ts(2554)
⚠ Error (TS2554) | Expected 2 arguments, but got 3.

JSDoc comments from the method signature that mentions the third parameter:

/**
 * Execute a mutation function.
 * @param mutation - A {@link server.FunctionReference} for the public mutation to run.
 * @param args — An arguments object for the mutation.
 * @param options — A {@link MutationOptions} options object for the mutation.
 * @returns — A promise of the mutation's result.
 */

The method should either accept the third parameter as documented or the documentation should be updated to reflect that only two parameters are accepted. Thank you.

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