Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Can't call mutate on the client when using Consumer #244

Open
russellmcc opened this issue Apr 20, 2020 · 2 comments
Open

Can't call mutate on the client when using Consumer #244

russellmcc opened this issue Apr 20, 2020 · 2 comments

Comments

@russellmcc
Copy link

I'm trying to use mutations with ReasonApollo.Consumer.

However, I'm not sure how I can do this:

    let mutation = ...;
    client.mutate(mutation);

gives me the error:

  This expression has type
    (ApolloClient.mutationObj =>
     Js.Promise.t(ReasonApolloMutation.renderPropObjJS))
    [@bs.meth]
  It is not a function.

using # syntax like client#mutate(mutation); gives me

  This expression has type ApolloClient.generatedApolloClient
  It has no method mutate

and using ## syntax like client##mutate(mutation); gives me

  This has type:
    ApolloClient.generatedApolloClient
  But somewhere wanted:
    Js.t('a)

So, the way I understand it, either the client should be a Js.t to allow calling the bs.meth or they shouldn't be tagged with bs.meth to allow calling using the typical method syntax.

@yawaramin
Copy link
Contributor

See also rescript-lang/rescript-compiler#4319

@develop7
Copy link

Affects me too when walking through the hasura's reason-apollo tutorial

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants