Commit fec0c36
authored
## Summary
The base-branch update brought in #9479's new test ("defers envelope
validation until the block is in fork choice when payload input is
seeded from the block body") which uses the same `let emitter!:
ChainEventEmitter` + destructuring-assignment + sibling closure capture
pattern that #9491 already mitigated in the original failing test below.
Same `TS2769` fires at the new test's emit site:
```
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'.
```
Also, #9479's emit predates this PR's addition of `slot: Slot` to the
`ChainEvent.unknownEnvelopeBlockRoot` event signature, so the emit data
is missing the required `slot` field after the merge.
## Fix
Same minimal cast workaround as #9491 plus the required `slot: 0` field:
```diff
- 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 (see #9491).
+ (emitter as ChainEventEmitter).emit(ChainEvent.unknownEnvelopeBlockRoot, {
rootHex: blockRootHex,
+ slot: 0,
peer,
source: BlockInputSource.gossip,
});
```
Single-site change. The 5 other
`emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, ...)` sites in the
file remain unchanged because they aren't reached through a sibling
closure capture; the cast at the sibling test's emit (introduced in
#9491, currently at line 1126) also remains as-is and continues to
typecheck cleanly with the expanded `EventType` union from #9439.
## Test plan
- [ ] CI: `Type Checks (24)` passes (no TS2769 on
`unknownBlock.test.ts`).
- [ ] CI: the new `defers envelope validation until the block is in fork
choice when payload input is seeded from the block body` test still
passes — emit semantics unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
1 parent 5440a4b commit fec0c36
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1024 | 1024 | | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
1028 | 1030 | | |
| 1031 | + | |
1029 | 1032 | | |
1030 | 1033 | | |
1031 | 1034 | | |
| |||
0 commit comments