How to use Reason in a TypeScript project?


#1

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?

#2

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.