fix(parseResponse): should not include error responses in result (#4348)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix(client): improve parseResponse type inference for conditional responses Previously, parseResponse would infer union types for routes that return different response types based on conditions (e.g., success vs error responses). This was incorrect because parseResponse throws errors for non-OK responses and should only return the success response type. Changes: - Use Extract<> utility type to filter success status code responses from union types - Add fallback logic for responses without explicit success status codes - Update test cases to match the corrected behavior - Add comprehensive test case for conditional response type inference The fix ensures that parseResponse(client['conditional-route'].$get()) correctly infers only the success response type instead of a union of all possible response types. * ci: apply automated fixes * test(client): fix parsedResponse test issue and remove unused test case * fix: minor type error in current runtime version * chore: add more test cases * feat: add `FilterClientResponses` util * fix(parseResponse): should not include error responses in result * chore: refactor to type-only tests and ordering * chore: rename type util and add JSDOC describe ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Zed tse <joexie@live.cn>
- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Diff stats
3 files+89 added−5 removed
- tests:+59 added−2 removed
- other:+30 added−3 removed