From 7a8a18f07d4e5a980771e3431245df53d1d29794 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 10 Jun 2026 20:40:33 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20chore:=20Use=20Element?= =?UTF-8?q?=20Access=20over=20`any`-Casts=20in=20Registry=20Cache=20Spec?= =?UTF-8?q?=20(#13664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The as-any casts existed only to reach the protected Keyv cache and private localSnapshotExpiry members. TypeScript's element-access escape hatch provides the same access fully typed, so the casts and their eslint-disable directives are unnecessary. The directives also reported as unused under configs that relax no-explicit-any for test files. --- ...nfigsCacheRedisAggregateKey.cache_integration.spec.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheRedisAggregateKey.cache_integration.spec.ts b/packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheRedisAggregateKey.cache_integration.spec.ts index eff9adb7df..2cc7f159ed 100644 --- a/packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheRedisAggregateKey.cache_integration.spec.ts +++ b/packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheRedisAggregateKey.cache_integration.spec.ts @@ -254,8 +254,7 @@ describe('ServerConfigsCacheRedisAggregateKey Integration Tests', () => { await cache.getAll(); // Spy on the underlying Keyv cache to count Redis calls - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const cacheGetSpy = jest.spyOn((cache as any).cache, 'get'); + const cacheGetSpy = jest.spyOn(cache['cache'], 'get'); await cache.getAll(); await cache.getAll(); @@ -325,11 +324,9 @@ describe('ServerConfigsCacheRedisAggregateKey Integration Tests', () => { await cache.getAll(); // prime snapshot // Force-expire the snapshot without sleeping - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (cache as any).localSnapshotExpiry = Date.now() - 1; + cache['localSnapshotExpiry'] = Date.now() - 1; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const cacheGetSpy = jest.spyOn((cache as any).cache, 'get'); + const cacheGetSpy = jest.spyOn(cache['cache'], 'get'); const result = await cache.getAll(); expect(cacheGetSpy.mock.calls).toHaveLength(1); expect(Object.keys(result).length).toBe(1);