Skip to content

Commit 932f905

Browse files
committed
fix: missing fetch/angular clients' types update
1 parent d0f71cf commit 932f905

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ export const createClient = (config: Config = {}): Client => {
125125

126126
const result: {
127127
request?: HttpRequest<unknown>;
128-
response: any;
128+
response?: any;
129129
} = {
130130
request: undefined,
131-
response: null,
131+
response: undefined,
132132
};
133133

134134
try {
@@ -178,7 +178,7 @@ export const createClient = (config: Config = {}): Client => {
178178
if (fn) {
179179
finalError = (await fn(
180180
finalError,
181-
result.response as any,
181+
result.response,
182182
result.request,
183183
options as any,
184184
)) as string;

packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ export const mergeHeaders = (
312312

313313
type ErrInterceptor<Err, Res, Req, Options> = (
314314
error: Err,
315-
response: Res,
315+
/** response may be undefined due to a network error where no response object is produced */
316+
response: Res | undefined,
316317
/** request may be undefined, because error may be from building the request object itself */
317318
request: Req | undefined,
318319
options: Options,

packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const createClient = (config: Config = {}): Client => {
218218
: {
219219
error: finalError,
220220
request,
221-
response: response as any,
221+
response,
222222
};
223223
}
224224
};

packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export type RequestResult<
127127
) & {
128128
/** request may be undefined, because error may be from building the request object itself */
129129
request?: Request;
130-
response: Response;
130+
/** response may be undefined, because error may be from building the request object itself or from a network error */
131+
response?: Response;
131132
}
132133
>;
133134

0 commit comments

Comments
 (0)