Just trying to generally understand what is going on here. Does this make sense to explain ReasonApolloTypes.gql as an example of using Externals.
This is the bs.module code
[@bs.module] external gql : ReasonApolloTypes.gql = "graphql-tag";
bs.module tells buckelscript that we want to use a FFI.
external
tells bs
the name of the FII we want to use and we set its value to ReasonApolloTypes.gql which is a globally available Reason module that we installed when we added reason-apollo in bsconfig's bs-dependencies array, and to package.json. If you open node_modules/reason-apollo/src you will see defined Reason modules that are globally available like any other.
ReasonApolloTypes.re is listed there and contains a defined type named gql. So ReasonApolloType.gql is the named module we are accessing with external gql
. In ReasonApolloType.gql there is a defined type, type gql = [@bs] (string => queryString);
. This tell bucklescript
to assign a type of string to the gql type and the assign the value to querystring, so type querystring
is of type string. Then set ReasonApolloTypes.gql to use the "graphql-tag" node library to resolve ReasonApolloTypes.gql.
Am I missing an concepts here? Is this expressed correctly? The Bucklescript/Reason docs are above my head for Externals at this point. Thanks.