Gentype: Typescript to Rescript types

I’m very new to reasonml/rescript community, What I know genType generates TS/flow types from rescript component while working in existing Typescript/flow codebase. Is there any other way around like I’m working on existing rescript codebase, does it generates bindings for rescript from typescript component/library types?

Can someone enlighten me?

1 Like

Welcome to the ReScript forum!

This has been discussed before here: Possible to import typescript packages into reason?

I think we won’t ever be able to fully automate this task, but a semi-automated way is often good enough. The most promising tool out there is ts2ocaml, which has an open PR for ReScript bindings. Still a lot of work open though, and I guess they are also waiting for some advances in the compiler repository.

Maybe the author @cannorin can shed some more light on its state.


@fham Thanks for answering

It’s about 70% done, as it can generate something that looks like a valid ReScript code, and it’s time to generate a lot of bindings and feed them to the compiler to see what happens.

Unfortunately the compiler needs some work to compile the generated codes: and

(also is very nice to have, as I would have to create my own bigint without it)

I’m currently waiting for the response to the PR and the issue. Once they are resolved, I can start the mass testing.


Thank you for working on this!

1 Like

The first paragraph of GenType claims that it uses types from typescript at: Introduction | ReScript GenType

I take that to mean that I don’t have to do anything with regard to types when importing typescript packages.

Small update: ReScript v10 is now out (pre-release) and I’m now doing the aforementioned mass testing with it.

I can confirm v10 is able to compile the output of ts2ocaml! It would still need some more work before releasing it but at least it’s not going to be a vaporware :grin:


Great news, excited to follow your progress!

1 Like