you likely know at compile time the types of the results you’re going to get, so depending on how you can to consume the results, you have multiple choices.
- create a record:
type okResults = {
a?: A.res,
b?: B.res,
c?: C.res,
}
- or you can use an array of variants:
type okResult =
| A(A.res)
| B(B.res)
| C(C.res)
type okResults = array<okResult>
You need to have some kind of knowledge of the shape of your result on compile time, otherwise the compiler can’t help you!