From 30e0cfd38ab4b351aa69f43fa9b5316a57420534 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 27 Aug 2026 23:15:46 +0200 Subject: [PATCH] Record what re-declaring the listener methods costs a subclass --- AGENTS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 4019f82..64b75ba 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -229,7 +229,8 @@ exactly 140. consumer. `declare on: …` and its six siblings re-type the inherited methods to return `unknown`, which emits nothing, needs no cast and leaves the runtime method on the prototype. Overriding them as real methods instead cannot work: the `super.on()` call needs a cast to satisfy the conditional - `Listener` type. `unknown` rather than `void | Promise` because a listener may return + `Listener` type. The cost is that a subclass can no longer reach those seven through `super` or + override them as methods — re-declaring them the same way is its way out. `unknown` rather than `void | Promise` because a listener may return anything — `session.on('close', () => set.delete(session))` returns a boolean. - **The TLS tests build their own self-signed certificate in DER** (`test/tls.test.ts`) instead of