diff --git a/compiler/lib/config.ml b/compiler/lib/config.ml index aad34fd42c..c49751610f 100644 --- a/compiler/lib/config.ml +++ b/compiler/lib/config.ml @@ -183,11 +183,12 @@ end (****) -let target_ : [ `JavaScript | `Wasm ] option ref = ref None +let target_ : [ `JavaScript | `Wasm | `None ] ref = ref `None let target () = match !target_ with - | Some t -> t - | None -> failwith "target was not set" + | `None -> failwith "target was not set" + | `JavaScript | `Wasm as t -> t -let set_target t = target_ := Some t +let set_target (t : [ `JavaScript | `Wasm ]) = + target_ := (t :> [ `JavaScript | `Wasm | `None ])