From 490105335ac6599c812488423f2e3e5bb7aa7d1d Mon Sep 17 00:00:00 2001 From: lodekeeper Date: Tue, 9 Jun 2026 12:04:51 +0000 Subject: [PATCH] fix(beacon-node): cast emitter at the failing emit site to fix tsgo overload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous restructure (#9488) removed the let !+destructuring pattern but tsgo still picks the wrong emit overload for ChainEvent.X at this site when emitter is captured by a sibling closure (the processBlock mock that emits routes.events.EventType.block). Same TS2769 error reproduces: test/unit/sync/unknownBlock.test.ts(1027,20): error TS2769: No overload matches this call. Argument of type 'ChainEvent.unknownEnvelopeBlockRoot' is not assignable to parameter of type 'unique symbol'. Apply an explicit (emitter as ChainEventEmitter) cast at the failing call site to re-anchor the StrictEventEmitter overload. Minimal change; the 5 other emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, ...) sites in the file remain unchanged because they aren't reached through a sibling closure capture. 🤖 Generated with AI assistance --- packages/beacon-node/test/unit/sync/unknownBlock.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts index 7f6fb56e85ae..9d45dede3464 100644 --- a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts +++ b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts @@ -1020,7 +1020,9 @@ describe("UnknownBlockSync", () => { emitter.emit(routes.events.EventType.block, {slot: 1, block: blockRootHex, executionOptimistic: false}); }); - emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, { + // tsgo overload-resolution miss when emit is reached through a closure that captures emitter + // first; cast re-anchors the StrictEventEmitter overload for ChainEvent keys. + (emitter as ChainEventEmitter).emit(ChainEvent.unknownEnvelopeBlockRoot, { rootHex: blockRootHex, slot: 0, peer,