diff --git a/.changeset/fluffy-candles-perform.md b/.changeset/fluffy-candles-perform.md new file mode 100644 index 000000000..f74b02d05 --- /dev/null +++ b/.changeset/fluffy-candles-perform.md @@ -0,0 +1,6 @@ +--- +'@hey-api/client-axios': patch +'@hey-api/client-fetch': patch +--- + +fix: allow responseTransformer property with body and headers diff --git a/packages/client-axios/src/types.ts b/packages/client-axios/src/types.ts index e1f2719d9..98db41f58 100644 --- a/packages/client-axios/src/types.ts +++ b/packages/client-axios/src/types.ts @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/client-fetch/src/types.ts b/packages/client-fetch/src/types.ts index fab60b8f4..d53ca45da 100644 --- a/packages/client-fetch/src/types.ts +++ b/packages/client-fetch/src/types.ts @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap index e1f2719d9..98db41f58 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap index e1f2719d9..98db41f58 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap index fab60b8f4..d53ca45da 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap index fab60b8f4..d53ca45da 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T;