Inserting a cast solves the type error:

$ echo > toto.ml <<EOF
let svg = Dom_svg.createSvg (Dom_html.window##document :> Dom_svg.document)
> EOF 
$ ocamlfind ocamlc -syntax camlp4o -package "js_of_ocaml js_of_ocaml.syntax" -c toto.ml
$ echo $?
0