atulmy/gql-query-builder

Custom mutation addapter type error when in strict mode

Opened this issue · 0 comments

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."
}
`