I have a specific case, where I want to bind javascript API (nodejs) environment, to Reason.
The object is as follows:
type ctx = {.
[@bs.set] "body": string,
"request": request,
"response": response
};
Here, as a standard, body might be several things:
string written
Buffer written
Stream piped
Object || Array json-stringified
null no content response
In typescript and flow you can produce such union easily, but in reasonML, this is obviously not possible:
type ctxBody = string | Js.t('a)
How does one achieve that?