WriteFn
A function that writes a string somewhere.
This is the only write primitive the output layer depends on. In production it usually wraps process.stdout.write or process.stderr.write; in tests it is often a simple string accumulator.
The contract is intentionally tiny:
writes are synchronous fire-and-forget
callers decide whether to append a trailing newline
there is no backpressure or flush signal
Import:
@kjanat/dreamcliExport kind: type
Declared in:
src/core/output/writer.tsSource link:
packages/dreamcli/src/core/output/writer.ts:33
Signatures
ts
type WriteFn = { (data: string): void; };Examples
ts
const lines: string[] = [];
const write: WriteFn = (data) => {
lines.push(data);
};