I have a React component
<Switch type="switch" /> (or
type="checkbox") from JS that takes a
type argument. Can I import it to ReScript with
@module external make and make it more idiomatic by converting the argument to
~type_: [#switch_ | #checkbox]?
I tried the
@as annotation in the arguments, but it doesn’t work well enough with
@string [@as("switch") #switch_ | #checkbox] works for
\"type"=#switch_ and converts it to
type: "switch", but in case of
type_=#checkbox still compiles to
type_: "checkbox", which of course does not work with the JS component.