[@@@react.dom]
let%component foo ~(bar : int option) =
div ~children:[React.string (string_of_int (Option.value ~default:0 bar))] ()
The inferred type is bar:int -> ?key:string -> unit -> React.element, but it should be bar:int option -> ?key:string -> unit -> React.element. Removing the type annotation fixes it.
The inferred type is
bar:int -> ?key:string -> unit -> React.element
, but it should bebar:int option -> ?key:string -> unit -> React.element
. Removing the type annotation fixes it.