Skip to content

Commit

Permalink
fix: allow responseTransformer property with body and headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlubos committed Sep 18, 2024
1 parent 38b0b68 commit 7ae2b1d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 42 deletions.
6 changes: 6 additions & 0 deletions .changeset/fluffy-candles-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hey-api/client-axios': patch
'@hey-api/client-fetch': patch
---

fix: allow responseTransformer property with body and headers
10 changes: 3 additions & 7 deletions packages/client-axios/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;
10 changes: 3 additions & 7 deletions packages/client-fetch/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,12 @@ export type Options<
ThrowOnError extends boolean = boolean,
> = T extends { body?: any }
? T extends { headers?: any }
? OmitKeys<
OptionsBase<ThrowOnError>,
'body' | 'headers' | 'responseTransformer'
> &
T
: OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'body' | 'headers'> & T
: OmitKeys<OptionsBase<ThrowOnError>, 'body'> &
T &
Pick<OptionsBase<ThrowOnError>, 'headers'>
: T extends { headers?: any }
? OmitKeys<OptionsBase<ThrowOnError>, 'headers' | 'responseTransformer'> &
? OmitKeys<OptionsBase<ThrowOnError>, 'headers'> &
T &
Pick<OptionsBase<ThrowOnError>, 'body'>
: OptionsBase<ThrowOnError> & T;

0 comments on commit 7ae2b1d

Please sign in to comment.