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 366d9b5c441..97989df889a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache @@ -35,7 +35,7 @@ export class Configuration { } get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; + const { apiKey } = this.configuration; if (!apiKey) { return undefined; } @@ -43,7 +43,7 @@ export class Configuration { } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; + const { accessToken } = this.configuration; if (!accessToken) { return undefined; } @@ -61,7 +61,7 @@ export class BaseAPI { this.middleware = configuration.middleware; } - withMiddleware = (middlewares: Middleware[]) => { + withMiddleware = (middlewares: Middleware[]): this => { const next = this.clone(); next.middleware = next.middleware.concat(middlewares); return next; @@ -121,7 +121,7 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone = (): BaseAPI => + private clone = (): this => Object.assign(Object.create(Object.getPrototypeOf(this)), this); } diff --git a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts index e4c93e87e51..ad383a11642 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts @@ -46,7 +46,7 @@ export class Configuration { } get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; + const { apiKey } = this.configuration; if (!apiKey) { return undefined; } @@ -54,7 +54,7 @@ export class Configuration { } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; + const { accessToken } = this.configuration; if (!accessToken) { return undefined; } @@ -72,7 +72,7 @@ export class BaseAPI { this.middleware = configuration.middleware; } - withMiddleware = (middlewares: Middleware[]) => { + withMiddleware = (middlewares: Middleware[]): this => { const next = this.clone(); next.middleware = next.middleware.concat(middlewares); return next; @@ -132,7 +132,7 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone = (): BaseAPI => + private clone = (): this => Object.assign(Object.create(Object.getPrototypeOf(this)), this); } 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 e4c93e87e51..ad383a11642 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts @@ -46,7 +46,7 @@ export class Configuration { } get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; + const { apiKey } = this.configuration; if (!apiKey) { return undefined; } @@ -54,7 +54,7 @@ export class Configuration { } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; + const { accessToken } = this.configuration; if (!accessToken) { return undefined; } @@ -72,7 +72,7 @@ export class BaseAPI { this.middleware = configuration.middleware; } - withMiddleware = (middlewares: Middleware[]) => { + withMiddleware = (middlewares: Middleware[]): this => { const next = this.clone(); next.middleware = next.middleware.concat(middlewares); return next; @@ -132,7 +132,7 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone = (): BaseAPI => + private clone = (): this => Object.assign(Object.create(Object.getPrototypeOf(this)), this); } 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 e4c93e87e51..ad383a11642 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts @@ -46,7 +46,7 @@ export class Configuration { } get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; + const { apiKey } = this.configuration; if (!apiKey) { return undefined; } @@ -54,7 +54,7 @@ export class Configuration { } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; + const { accessToken } = this.configuration; if (!accessToken) { return undefined; } @@ -72,7 +72,7 @@ export class BaseAPI { this.middleware = configuration.middleware; } - withMiddleware = (middlewares: Middleware[]) => { + withMiddleware = (middlewares: Middleware[]): this => { const next = this.clone(); next.middleware = next.middleware.concat(middlewares); return next; @@ -132,7 +132,7 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone = (): BaseAPI => + private clone = (): this => Object.assign(Object.create(Object.getPrototypeOf(this)), this); } 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 e4c93e87e51..ad383a11642 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 @@ -46,7 +46,7 @@ export class Configuration { } get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; + const { apiKey } = this.configuration; if (!apiKey) { return undefined; } @@ -54,7 +54,7 @@ export class Configuration { } get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; + const { accessToken } = this.configuration; if (!accessToken) { return undefined; } @@ -72,7 +72,7 @@ export class BaseAPI { this.middleware = configuration.middleware; } - withMiddleware = (middlewares: Middleware[]) => { + withMiddleware = (middlewares: Middleware[]): this => { const next = this.clone(); next.middleware = next.middleware.concat(middlewares); return next; @@ -132,7 +132,7 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone = (): BaseAPI => + private clone = (): this => Object.assign(Object.create(Object.getPrototypeOf(this)), this); }