I have some typescript objects whose fields are typed as string | number | boolean
or as boolean | object
. If I have to create such a record / object in Rescript before passing it off to Typescript code,
how do I model my record types? I want the values to be unboxed, but @unboxed and @unwrapped do not fit my use case.
type context = Boolean(bool) | Object({val: int, flag: bool})
type t = {
context: context,
...
}
I’d like to be able to set a boolean or an object in the record field context
. Is there a way in ReScript or a workaround?