Type discrimination between data
and error
doesn't work
#1609
Labels
bug
Something isn't working
good first issue
Straightforward problem, solvable for first-time contributors without deep knowledge of the project
openapi-fetch
Relevant to the openapi-fetch library
PRs welcome
PRs are welcome to solve this issue!
Description
A simple if-statement on
dataRes.data
fails to correctly discriminatedata
anderror
, which results in theerror
type beingnever
:The OpenAPI spec used for this example
Reproduction
https://stackblitz.com/edit/vitejs-vite-vnadlg?file=README.md&view=editor
Expected result
It should allow checking
dataRes.data
ordataRes.error
and choosing either the success type or the error typeChecklist
The text was updated successfully, but these errors were encountered: