mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
A JavaScript child stream (`child.stdout`) reached through the child's checked-dynamic box registers its listeners through the stream's own `on`. The declarations type an unannotated 'data' listener's chunk as a Buffer, so the listener body checked the chunk as one and threw `TypeError: expected Uint8Array at $, got string` once `setEncoding` made the stream pass strings, as in Node's test-child-process-default-options. When the file calls `setEncoding` on the same access path, an inline 'data' listener registered with on, once, addListener, prependListener or prependOnceListener now binds its unannotated chunk as a checked-dynamic value, which holds the string or the Buffer Node passes. Streams without a `setEncoding` call keep the Buffer-typed chunk.