Allow returning arbitrary values
We're looking at using this library to wrap a portion of our existing data loader implementation. A headache that has come up is that redis-dataloader does not allow returning primitives, only JSON. This makes consuming data loaders that return, for example, a simple count, somewhat more cumbersome. It is achievable by returning something like { count: 21 }, but then every consumer (generally GraphQL type resolvers) must pull that value out of the response from the data loader.
Is there a reason that redis-dataloader could not allow arbitrary primitives, such as numbers?
yeah that makes sense
Cool - how can I help?
this is the issue right? https://github.com/PatrickJS/redis-dataloader/blob/master/index.js#L100
Hmm, I don't think so. From reading that code, if a non-object is passed in, it should just pass it through directly. However, according to @mahcloud, if a non-object is passed in, an error is thrown. I can look at getting the specific error if that's helpful.
yeah, we're thinking about rewriting the package in typescript too so any problems you run into let me know
Hi @PatrickJS I was wondering if there was any progress on this topic, or anything we may track which is related to this issue?