[GH-ISSUE #70] Custom mutation addapter type error when in strict mode #139

Open
opened 2026-03-15 11:36:17 +03:00 by kerem · 0 comments
Owner

Originally created by @jgomesmv on GitHub (Jul 4, 2022).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/70

After creating a custom mutation adapter it throws an error when I pass it's type on mutation function.
In order to check if the problem was related with my adapter code I tried to pass the default mutation adapter directly and the same error occurs.

Steps to reproduce:

  1. Setup an angular v13 solution (using typescript strict mode)
  2. Execute the mutation function passing DefaultMutationAdapter type as parameter
  3. The error is thrown: Argument of type 'typeof DefaultMutationAdapter' is not assignable to parameter of type 'IMutationAdapter'. Type 'typeof DefaultMutationAdapter' is missing the following properties from type 'IMutationAdapter': mutationBuilder, mutationsBuilder'. Type 'IMutationAdapter' is missing the following properties from type 'IMutationAdapter': mutationBuilder, mutationsBuilder

Example:
`
import * as gql from 'gql-query-builder';
import DefaultMutationAdapter from 'gql-query-builder/build/adapters/DefaultMutationAdapter';

const query = gql.mutation({
operation: 'thoughtCreate',
variables: {
name: 'Tyrion Lannister',
thought: 'I drink and I know things.'
},
fields: ['id']
}, DefaultMutationAdapter);

console.log(query);

// Output
mutation ($name: String, $thought: String) {
thoughtCreate (name: $name, thought: $thought) {
id
}
}

// Variables
{
"name": "Tyrion Lannister",
"thought": "I drink and I know things."
}
`

Originally created by @jgomesmv on GitHub (Jul 4, 2022). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/70 After creating a custom mutation adapter it throws an error when I pass it's type on mutation function. In order to check if the problem was related with my adapter code I tried to pass the default mutation adapter directly and the same error occurs. Steps to reproduce: 1. Setup an angular v13 solution (using typescript strict mode) 2. Execute the mutation function passing DefaultMutationAdapter type as parameter 3. The error is thrown: `Argument of type 'typeof DefaultMutationAdapter' is not assignable to parameter of type 'IMutationAdapter'. Type 'typeof DefaultMutationAdapter' is missing the following properties from type 'IMutationAdapter': mutationBuilder, mutationsBuilder'. Type 'IMutationAdapter' is missing the following properties from type 'IMutationAdapter': mutationBuilder, mutationsBuilder` Example: ` import * as gql from 'gql-query-builder'; import DefaultMutationAdapter from 'gql-query-builder/build/adapters/DefaultMutationAdapter'; const query = gql.mutation({ operation: 'thoughtCreate', variables: { name: 'Tyrion Lannister', thought: 'I drink and I know things.' }, fields: ['id'] }, DefaultMutationAdapter); console.log(query); // Output mutation ($name: String, $thought: String) { thoughtCreate (name: $name, thought: $thought) { id } } // Variables { "name": "Tyrion Lannister", "thought": "I drink and I know things." } `
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#139
No description provided.