How to Create a Custom Library to be used in Rescript and Typescript Codebase

Hey Guys, I have a few functions written in rescript and I am trying to expose it in a custom Library. I am facing the challenge to export it correctly. Bucklescript compiler coverts .res files to .bs.js and .gen.tsx files.
I want to import this library in rescript codebase and a typescript codebase. One approach is to export compiled functions from index.js file. Like export all from compiled bs.js files. But this means I’ll have to create bindings in each of my consumers. Both in Rescript and Typescript Consumer. I was looking out for any such examples of a custom Library. I want to be able to use the rescript functions in Rescript Consumers and Js files in Typescript packages.

Having to write type bindings in cosumer packages is a sucker, it will defeat the purpose of writing a custom Library to reuse code.

1 Like

You can use ReScript libraries in other ReScript projects. You don’t need to write bindings to the output .bs.js files.