Sometimes when I switch on an option
, rescript will pull in some stdlib from ocaml, which typically creates an error and increases the bundle size
@scope("document") external querySelector: string => option<Dom.element> = "querySelector"
@get external src: Dom.element => string = "src"
let src2 = switch querySelector("script") {
| Some(script) => script->src
| None => ""
}
import * as Caml_option from "./stdlib/caml_option.js";
var script = document.querySelector("script");
var src2 = script !== undefined ? Caml_option.valFromOption(script).src : "";
Is there something specific triggering this extra wrapper from being added, and is there a way to workaround it?