I’ve been looking at Rescript for writing reducer-style code at work, which would require GraphQL support, though in a slightly unusual way. That’s a bit of a wrinkle, since, from playing around with it, graphql-ppx has trouble with certain important features in uncurried mode (for example, fragments). As such, on the side, I’ve been working on binding to graphql-codegen, which has resulted in this monorepo:
Still working on the actual plugin (need to alias keywords, amongst other things), but I’m pretty happy with the bindings to
graphql-codegen, so thought I’d mention it in the forums for posterity.
This is great! Cc @cometkim
Nice showcase of v11 features in the bindings as well.
At some point one could look into leveraging this to get a DX inspired by graphql-ppx: GitHub - zth/rescript-embed-lang: A general purpose PPX and library for embedding other languages into ReScript, via code generation.
Very interesting. Will have to look into that once I hammer the plugin into shape.
Feel free to DM me when you’re getting close and we’ll figure it out together. Also feel free to DM (or just post here) about any eventual issues around generating ReScript types for GraphQL. I’ve done that a fair bit myself so I’ve likely hit some if the issues you might face.
Excited about your work!
I’m writing a set of graphql-codegen plugin for rescript https://github.com/cometkim/rescript-codegen/tree/main/packages%2Fgraphql-codegen-rescript
After a few more works and fixing a compiler bug, I think it will be better to push to the upstream (graphql-codegen-community), so it should be TypeScript codebase.
However, bindings for graphql-js is good to have, and actually useful a lot!
Yeah, the particular use case I’m thinking of has some unique needs, so I knew I’d have to be writing codegen myself anyways, and decided to play around with the type generation, too. I’d be happy to move off of a self-written plugin for the general types, but hopefully the bindings will be good for per-project plugins, both for myself and others.