mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
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>
12 lines
392 B
TypeScript
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));
|