diff --git a/lib/zapAggregation.ts b/lib/zapAggregation.ts index 84669a9..7a3ded4 100644 --- a/lib/zapAggregation.ts +++ b/lib/zapAggregation.ts @@ -85,7 +85,8 @@ function collectZap( sub.on('eose', () => done()) setTimeout(() => done(), timeout).unref?.() if (typeof (sub as unknown as { on?: unknown }).on === 'function') { - ;(sub as any).on('error', onError) + const subWithError = sub as unknown as { on: (event: string, handler: (error: Error) => void) => void } + subWithError.on('error', onError) } }) }