gql-query-builder
gql-query-builder copied to clipboard
Custom mutation addapter type error when in strict mode
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:
- Setup an angular v13 solution (using typescript strict mode)
- Execute the mutation function passing DefaultMutationAdapter type as parameter
- 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." } `