How to use Reason in a TypeScript project?


Since Reason compiles to JavaScript, I think it’s not big deal for Webpack to handle it. But TypeScript always want types, how to deal with that?

There might be two scenarios:

  • using Reason code inside a TypeScript project directly, how?
  • using modules in Reason in a TypeScript project, how do I generate all the types TypeScript need?


You can use genType to generate typescript types via annotations from reason code.

For the other way around, there is also some helpers, though I did not use that personally.


The Bucklescript docs refer to a -bs-gen-tds option here:

Trigger the generation of TypeScript .d.ts files.

When I try to run bsc, I get

unknown option ‘-bs-gen-tds’

Has this option been removed at some point and are the docs outdated?

There is also this issue (, that is more than 2 years old and haven’t seen any activity in over a year - could anyone weigh in on what the current status is?

A clarification would be greatly appreciated!


Hey there, yeah -bs-gen-tds has been removed. According to @bobzhang it was an experimental feature and didn’t pan out. The best (automated) option we have today is to use genType.


Ok, that’s good to know - thanks!