0

I am trying to understand the Apollo client in an Angular client. The following code gives me no typings:

fireMutation() {
  this.apollo.mutate<{foo: string}>({
    mutation: gql`some mutation {}`,
    variables: {}
  }).subscribe(v => {
    // No typings on v.
    return;   
  });
}

I found this issue on Github, but it's apparently not related to the issue I'm facing.

I have created a Stackblitz here, to make it easy for you to confirm.

DauleDK
  • 3,313
  • 11
  • 55
  • 98

1 Answers1

1

Based on this Github comment, I found the solution.

The fix was to install graphql types: npm i @types/graphql --save-dev.

I updated the stackblitz, and it now works

working types apollo/mutation

Many thanks to ekron.

DauleDK
  • 3,313
  • 11
  • 55
  • 98