Comments (4)
So that type t
is abstract because the types are unimplemented. You can either cast your field merge function like so:
let myMergeFunction: FieldMergeFunction.Js_.t = Obj.magic((existing, incoming) => { ... })
or you could make a PR to flesh out the types :)
from rescript-apollo-client.
Perfect- that did the trick! Thank you!
I'd love to PR to help, but the type of this is beyond my understanding... I'm not sure how to have a union type of a function and true
that resolve to JS.
module FieldMergeFunction = {
type t<'existing> =
| Function(('existing, 'existing) => 'existing)
| True
}
from rescript-apollo-client.
Great! If you do indeed want to do the work of a PR, I'm happy to help guide you a little, but no pressure.
If you do go down that path, please read the contributing section that explains some of the weird Js_
modules
There's an old blog post about representing unions like this in ReScript: https://rescript-lang.org/blog/union-types-in-bucklescript
And there are many examples in the code. Here is one:
https://github.com/jeddeloh/rescript-apollo-client/blob/d75edfd0e4e0a4ac201e2b7424331f6b411b4cd7/src/%40apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_Policies_FieldPolicy.res
from rescript-apollo-client.
Perfect, thank you! I'll close out this issue and push a WIP PR when I get stumped. Thanks!
from rescript-apollo-client.
Related Issues (20)
- RetryLink and OnError Handling issue HOT 6
- Link headers HOT 2
- EOL for ppx in rescript HOT 3
- Read variables from within the `useMutation`'s `update` function HOT 3
- Nullable field being discarded from mutation HOT 4
- pollInterval option missing from watchQuery
- Incompatibility/Bug with @apollo/client > 3.5.0 HOT 2
- Runtime error with ApolloClient.Utilities.getOperationDefinition function HOT 3
- @apollo/client 3.5 features HOT 1
- Fetching fragment along with other fields HOT 2
- Support `returnPartialData` option after graphql-ppx adds support
- Support for RefetchQueriesFunction HOT 1
- support to nextjs ? HOT 2
- Getting Jest tests to ignore module
- ErrorLink and RetryLLink examples and/or documentation HOT 6
- Is it possible to remove react and rescript-react as dependencies for this to work? HOT 1
- Support rescript 10 HOT 3
- [Discussion] Convert to using optional records? HOT 1
- subscriptions-transport-ws has been deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rescript-apollo-client.