diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache index a978bd7d2cc..366d9b5c441 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache @@ -36,12 +36,18 @@ export class Configuration { get apiKey(): ((name: string) => string) | undefined { const apiKey = this.configuration.apiKey; - return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey); + if (!apiKey) { + return undefined; + } + return typeof apiKey === 'string' ? () => apiKey : apiKey; } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { const accessToken = this.configuration.accessToken; - return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken); + if (!accessToken) { + return undefined; + } + return typeof accessToken === 'string' ? () => accessToken : accessToken; } } diff --git a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts index 40d2e7b3947..e4c93e87e51 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts @@ -47,12 +47,18 @@ export class Configuration { get apiKey(): ((name: string) => string) | undefined { const apiKey = this.configuration.apiKey; - return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey); + if (!apiKey) { + return undefined; + } + return typeof apiKey === 'string' ? () => apiKey : apiKey; } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { const accessToken = this.configuration.accessToken; - return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken); + if (!accessToken) { + return undefined; + } + return typeof accessToken === 'string' ? () => accessToken : accessToken; } } diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts index 40d2e7b3947..e4c93e87e51 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts @@ -47,12 +47,18 @@ export class Configuration { get apiKey(): ((name: string) => string) | undefined { const apiKey = this.configuration.apiKey; - return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey); + if (!apiKey) { + return undefined; + } + return typeof apiKey === 'string' ? () => apiKey : apiKey; } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { const accessToken = this.configuration.accessToken; - return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken); + if (!accessToken) { + return undefined; + } + return typeof accessToken === 'string' ? () => accessToken : accessToken; } } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts index 40d2e7b3947..e4c93e87e51 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts @@ -47,12 +47,18 @@ export class Configuration { get apiKey(): ((name: string) => string) | undefined { const apiKey = this.configuration.apiKey; - return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey); + if (!apiKey) { + return undefined; + } + return typeof apiKey === 'string' ? () => apiKey : apiKey; } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { const accessToken = this.configuration.accessToken; - return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken); + if (!accessToken) { + return undefined; + } + return typeof accessToken === 'string' ? () => accessToken : accessToken; } } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts index 40d2e7b3947..e4c93e87e51 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts @@ -47,12 +47,18 @@ export class Configuration { get apiKey(): ((name: string) => string) | undefined { const apiKey = this.configuration.apiKey; - return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey); + if (!apiKey) { + return undefined; + } + return typeof apiKey === 'string' ? () => apiKey : apiKey; } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { const accessToken = this.configuration.accessToken; - return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken); + if (!accessToken) { + return undefined; + } + return typeof accessToken === 'string' ? () => accessToken : accessToken; } }