This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
Convert REST response type to tagged union #115
Labels
area: rest-api
Related to the REST API specifically
priority: low
Low priority issue
story point: 1
Quick copy change
type: chore
All other necessary (but less impactful) tasks
Milestone
Currently, to determine whether a
RawResponse<T>
is aResponse<T>
or anErrorResponse
, we test whether thepayload
field exists. This is kind of cumbersome and is why we ship anisErrorResponse
function with the types package, but we could just addsuccess: true
to the former variant ofRawResponse<T>
andsuccess: false
to the latter.This would make error checking as simple as testing
res.success
, and would also allow consumers of the types package to only add it as adevDependency
(not sure if the latter matters as much though).The text was updated successfully, but these errors were encountered: