I’m trying to export types that depend on another ML module, but genType produces TypeScript code that assumes the module to import from is in the same directory, when it is not.
To illustrate:
root.ml
type foo = Types.bar * Types.bar [@@genType]
inner/types.ml
type bar = int * string [@@genType]
These files will compile happily enough, but root.gen.tsx will import from './Types.gen' instead of './inner/types.gen', as would be desired.
ReScript itself produces valid code for this import structure; it’s just the generated TypeScript that fails.
Right, I’ve done that, and that’s actually revealed some more specific details.
It turns out, the issue is specifically when using a type from a module written in Caml in another directory, whilst using a type from another ReScript module is fine.