At present a Client derived from an API loses all type-safety in regards to any non-2xx status codes which are returned directly when making use of the Client's methods.
The way to recover access errors are via ClientError. The server-side ClientError's, which do have a status, are typed as unknown and must be re-validated manually to ensure type-safety on the client-side by hand.
In an ideal world I think these would be strongly typed by default by using the "success" channel of Effect to return all "expected", as defined by your API, instead of only 2xx status codes. This allows for type-safe transformation of all "expected" status codes into domain-specific values and/or failures to correspond with these other expected conditions.
Prior Discussion: #515
At present a
Clientderived from anAPIloses all type-safety in regards to any non-2xx status codes which are returned directly when making use of theClient's methods.The way to recover access errors are via
ClientError. The server-sideClientError's, which do have a status, are typed asunknownand must be re-validated manually to ensure type-safety on the client-side by hand.In an ideal world I think these would be strongly typed by default by using the "success" channel of Effect to return all "expected", as defined by your
API, instead of only 2xx status codes. This allows for type-safe transformation of all "expected" status codes into domain-specific values and/or failures to correspond with these other expected conditions.Prior Discussion: #515