From 4dc10e30652579b647b72274da595cfdad2af398 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 19 May 2024 07:47:25 +0200 Subject: [PATCH] fix: add explicit type annotations to `Interceptors` --- packages/openapi-ts/src/templates/core/OpenAPI.hbs | 4 ++-- .../test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap | 4 ++-- .../test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap | 4 ++-- .../test/generated/v3_angular/core/OpenAPI.ts.snap | 4 ++-- .../test/generated/v3_axios/core/OpenAPI.ts.snap | 4 ++-- .../test/generated/v3_client/core/OpenAPI.ts.snap | 4 ++-- .../test/generated/v3_enums_typescript/core/OpenAPI.ts.snap | 4 ++-- .../generated/v3_legacy_positional_args/core/OpenAPI.ts.snap | 4 ++-- .../__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap | 4 ++-- .../test/generated/v3_options/core/OpenAPI.ts.snap | 4 ++-- .../__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/openapi-ts/src/templates/core/OpenAPI.hbs b/packages/openapi-ts/src/templates/core/OpenAPI.hbs index 2fcf933bf..9b501bf08 100644 --- a/packages/openapi-ts/src/templates/core/OpenAPI.hbs +++ b/packages/openapi-ts/src/templates/core/OpenAPI.hbs @@ -20,14 +20,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap index 5f049af07..eda4c9d4b 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap @@ -12,14 +12,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap index f08bd7576..4bbc86a7f 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap @@ -12,14 +12,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap index 091d25a4e..e62d0c4ce 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap @@ -12,14 +12,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap index 7286660a4..438d879ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap index ec476fed8..afe4ec663 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap @@ -11,14 +11,14 @@ export class Interceptors { this._fns = []; } - eject(fn: Middleware) { + eject(fn: Middleware): void { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } - use(fn: Middleware) { + use(fn: Middleware): void { this._fns = [...this._fns, fn]; } }