Consider these bindings:
@send external get1: (map<'v>, string) => Js.undefined<'v> = "get"
@send external get2: (map<'v>, string) => option<'v> = "get"
@send @return(undefined_to_opt) external get3: (map<'v>, string) => option<'v> = "get"
get1
would require a wrapper to convert undefined
to option
. I understand it is not recommended to annotate get2
with type parameter, per Caveat 1
Does the @return
in get3
patch Caveat 1? When is @return(undefined_to_opt)
used in general? For example, why
@send @return(undefined_to_opt) external getInt1: (map<int>, string) => option<int> = "get"
instead of
@send external getInt1: (map<int>, string) => option<int> = "get"
?