From a339123586ce2338bb42b8c236c29bc7a54e8cab Mon Sep 17 00:00:00 2001 From: javier-garcia-meteologica <61506396+javier-garcia-meteologica@users.noreply.github.com> Date: Mon, 6 Jun 2022 17:42:52 +0200 Subject: [PATCH] Fix typescript-fetch compatibility with noUncheckedIndexedAccess (#12542) (#12543) --- .../src/main/resources/typescript-fetch/runtime.mustache | 2 +- .../petstore/typescript-fetch/builds/default-v3.0/runtime.ts | 2 +- .../client/petstore/typescript-fetch/builds/default/runtime.ts | 2 +- samples/client/petstore/typescript-fetch/builds/enum/runtime.ts | 2 +- .../petstore/typescript-fetch/builds/es6-target/src/runtime.ts | 2 +- .../typescript-fetch/builds/multiple-parameters/runtime.ts | 2 +- .../builds/prefix-parameter-interfaces/src/runtime.ts | 2 +- .../typescript-fetch/builds/sagas-and-records/src/runtime.ts | 2 +- .../petstore/typescript-fetch/builds/with-interfaces/runtime.ts | 2 +- .../typescript-fetch/builds/with-npm-version/src/runtime.ts | 2 +- .../typescript-fetch/builds/with-string-enums/runtime.ts | 2 +- .../builds/without-runtime-checks/src/runtime.ts | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) 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 6fc46aff26f..5dacb67bf55 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -260,7 +260,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts index ea3594773af..1ab0a775e9c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts index b9cb54736f8..cd6f5def237 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) 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 a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index a8137ef03e8..fd8de02dd81 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts index b9cb54736f8..cd6f5def237 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts @@ -269,7 +269,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts index 63afbb449c5..3e4ccfc28f2 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts @@ -265,7 +265,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -function querystringSingleKey(key: string, value: string | number | null | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))