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 25a2731a3d3e..9902d44bb382 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -211,10 +211,12 @@ export interface RequestOpts { body?: HTTPBody; } +{{^withoutRuntimeChecks}} export function exists(json: any, key: string) { const value = json[key]; return value !== null && value !== undefined; } +{{/withoutRuntimeChecks}} export function querystring(params: HTTPQuery, prefix: string = ''): string { return Object.keys(params) @@ -238,12 +240,14 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } +{{^withoutRuntimeChecks}} export function mapValues(data: any, fn: (item: any) => any) { return Object.keys(data).reduce( (acc, key) => ({ ...acc, [key]: fn(data[key]) }), {} ); } +{{/withoutRuntimeChecks}} export function canConsumeForm(consumes: Consume[]): boolean { for (const consume of consumes) { 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 50d885957985..5b3f9d13f6c4 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 @@ -222,10 +222,6 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} export function querystring(params: HTTPQuery, prefix: string = ''): string { return Object.keys(params) @@ -249,12 +245,6 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string { .join('&'); } -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} export function canConsumeForm(consumes: Consume[]): boolean { for (const consume of consumes) {