ocsigen / ts2ocaml

Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate separate, smaller source files

zbaylin opened this issue · comments

I am currently using ts2ocaml to generate bindings to a fairly large TypeScript library. ts2ocaml produces an mli file approximately 8.2MB in size, which causes both ocamlopt and ocamlc to stack overflow at the default system stack limit on my Macbook Pro.

I am fairly certain this could be solved by generating separate interface files, since modules can't be recursively dependent anyway.

i.e. transform
src.mli:

module X : sig
  ...
end
module Y : sig
  ...
end

into
x.mli, y.mli withsrc.mli:

module X = X
module Y = Y

I recognize that this is a "nice-to-have" and probably doesn't represent a widespread need, but would be very helpful in making builds of my library easier!