Dependency cycle with firebase-functions + follow-relative-references
Programmerino opened this issue · comments
The command:
ts2ocaml res --output-dir src --follow-relative-references node_modules/firebase-functions/lib/v2/index.d.ts
produces code with a dependency cycle with doesn't compile on ReScript:
FAILED: dependency cycle: src/firebase_functions__alerts-RescriptTemplate.cmj -> src/firebase_functions__app_distribution-RescriptTemplate.cmj -> src/firebase_functions__alerts-RescriptTemplate.cmj.
I'm using ReScript 11.1.0-rc.3
and ts2ocaml 2.0.0-beta.2
. I manually modified firebase_functions__options.res
to avoid #392
It seems that the original type definition from firebase-functions
contains mutually recursive source files. ReScript does not support that, and it would be difficult for ts2ocaml
to perform some kind of unrolling/flattening without breaking something to fix that automatically.
ts2ocaml
does provide an option --merge, which just merges all the input files at the risk of breaking relative imports and increasing the output size. But in this case, the --merge
option would rather break the generated binding than fixing it, as firebase-functions
is a fairly large library with a lot of relative imports.
I think you would have to fix it by hand, unfortunately. I consider this a limitation of the tool rather than a bug, and I will add an explanation of it to the docs.