Starting with
type errorType = NeedAuthToken | BadAuthToken
type t =
| Error(errorType)
| Loading({ready: bool})
| Done({data: string})
Responses.Error(Responses.NeedAuthToken)
we get
{ TAG: 'Error', _0: 'NeedAuthToken' }
Using the new @tag(“state”) like
type errorType = NeedAuthToken | BadAuthToken
@tag("state")
type t =
| Error(errorType)
| Loading({ready: bool})
| Done({data: string})
I get
{ state: 'Error', _0: 'NeedAuthToken' }
But can we go deeper? Can we get rid of the weird key _0 ?