Files
scriptc/tests/diagnostics/stream-completion-callback-error.ts
T
Malte UblandClaude Opus 5.5 44f4e2e74c Refuse inline stream completion callbacks that name the error
Node passes write and end callbacks an error argument (null on success),
but the native callbacks receive none, so an inline callback that names
the parameter read undefined. It now refuses where it is written. The
stream-shims npm case compiles now that stream subclasses are values;
its remaining scenarios are deferred refusals, so it is recorded as one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:50:20 -07:00

12 lines
392 B
TypeScript

import { Writable } from "node:stream";
// Node passes write and end callbacks an error argument (null on success);
// the native callbacks receive none, so a callback that names it refuses.
const sink = new Writable({
write(_chunk, _encoding, done) {
done();
},
});
sink.write("a", (err) => console.log("written", err));
sink.end((err?: Error | null) => console.log("ended", err));