Inserting a cast solves the type error: $ echo > toto.ml < Dom_svg.document) > EOF $ ocamlfind ocamlc -syntax camlp4o -package "js_of_ocaml js_of_ocaml.syntax" -c toto.ml $ echo $? 0