-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@hey-api/client-fetch: Error is unknown when using default #691
Comments
I think the problem is caused by
The causes the error to be filtered twice, because the Changing line 403 to : |
cc @gergan |
Yes I think @mlankamp is correct -> operation.errors are set in operation.ts and they are already filtered through getErrorResponses so no need to filter them once more. It seems that removing the function call is the correct thing to do. Albeit my question is if the logic for the default in
inferDefaultResponse tries to identify if there are declared success responses and in this way decides if the default is only for error responses...
|
I'm running into this as well - unfortunately it causes issues with discriminating the const { data, error } = await foo();
if (error) throw error;
data; // TypeScript still thinks this is `Response | undefined` because it can't discriminate the type of `data` based on the `unknown` error type. |
Sorry for the delay all, try with the next version once it's released |
Description
The I use a non-200 response code, the Error object is created with a specific type. But if I use response code
default
the response is created asunknown
OpenAPI specification (optional)
Configuration
System information (optional)
Example repo: https://github.com/mlankamp/openapi
The text was updated successfully, but these errors were encountered: