[typescript-fetch] Fix response type to be Response or undefined (#13825)

* Fix response type to be Response or undefined

Current generated code produces a `response` variable set to undefined, and TS does not like you changing the type of the variable later. Therefore, set the type of the variable to be `Response` or `undefined`

Solves OpenAPITools/openapi-generator#12007

* Update samples
This commit is contained in:
Glenn Olsson
2022-12-03 19:27:58 +01:00
committed by GitHub
parent 22bd3e31dc
commit 94dccae82d
13 changed files with 13 additions and 13 deletions

View File

@@ -166,7 +166,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {

View File

@@ -177,7 +177,7 @@ export class BaseAPI {
}) || fetchParams;
}
}
let response = undefined;
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {