genType incorrectly assumes flat directory structure

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.

Feel free to provide a self-contained example and version info. This normally works on project setups tested.

Sure, I’ve put together a self-contained example here:

This uses ReScript v9.1.4 and genType v4.5.0.

Thank you.
Try to convert to .res files.
A .ml issue is not likely to receive much attention.

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.

See the generated TS in the repo.