bs.optional
can be used with bs.deriving abstract
to mark fields as optional.
For example:
[@bs.deriving abstract]
type person = {
name: string,
[@bs.optional] age: int
};
let misha = person(~name="Misha", ());
compiles to:
var misha = {
name: "Misha"
};