diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index 741a1ba5545..4f10c8d1c7d 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -189,12 +189,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') { const fullKey = prefix + (prefix.length ? `[${key}]` : key); const value = params[key]; if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(singleValue)) + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) .join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Object) { - return querystring(value, fullKey); + return querystring(value as HTTPQuery, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; }) diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index 593648d3776..0ed72ba5352 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') { const fullKey = prefix + (prefix.length ? `[${key}]` : key); const value = params[key]; if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(singleValue)) + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) .join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Object) { - return querystring(value, fullKey); + return querystring(value as HTTPQuery, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; }) diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/runtime.ts index 593648d3776..0ed72ba5352 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/runtime.ts @@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') { const fullKey = prefix + (prefix.length ? `[${key}]` : key); const value = params[key]; if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(singleValue)) + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) .join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Object) { - return querystring(value, fullKey); + return querystring(value as HTTPQuery, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; }) diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index 593648d3776..0ed72ba5352 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') { const fullKey = prefix + (prefix.length ? `[${key}]` : key); const value = params[key]; if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(singleValue)) + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) .join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Object) { - return querystring(value, fullKey); + return querystring(value as HTTPQuery, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; }) diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/runtime.ts index 593648d3776..0ed72ba5352 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/runtime.ts @@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') { const fullKey = prefix + (prefix.length ? `[${key}]` : key); const value = params[key]; if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(singleValue)) + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) .join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Object) { - return querystring(value, fullKey); + return querystring(value as HTTPQuery, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; })