I am looking to rewrite a library in ReScript that is currently in Flow. The main consumers of this library will be TypeScript, but I would like to write it in ReScript and expose it to typescript through
genType. I think it would be a great example of how libraries can be written in ReScript while being consumed in a more mainstream language. It can also be a great way for people to find out about ReScript.
The issue here is that I’d like it to be compatible with a ReScript binding package (
rescript-apollo-client). I think it can work both ways, with referring to the ReScript types in the API surface and writing
genType shims for TypeScript. The problem is that I don’t want the package to directly rely on the ReScript bindings. I can use peerDependencies, but it would not be great to have a warning for most people that would just be consuming the TypeScript version.
This is a problem that exists for many libraries because of the nominal typing in ReScript (mainly records), so you have to rely on the actual binding.
Interested to hear about possible solutions to this!