forked from loafle/openapi-generator-original
[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:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user