You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2593,23 +2593,27 @@ Type: `ReactNode`
2593
2593
2594
2594
Type: `object`
2595
2595
2596
+
The streams don't have to be terminal streams. `stdout` and `stderr` only need a `write()` method, so a stream that captures output in memory works, and the exported `InkOutputStream` and `InkInputStream` types describe those shapes. Interactive rendering and [`useWindowSize()`](#usewindowsize) also call `on()` and `off()` on `stdout`, and handling input needs the raw mode methods on `stdin`, so see those types for the full contract.
2597
+
2598
+
`RenderOptions` itself defaults to Node's stream types, which is what [`useStdout()`](#usestdout), [`useStdin()`](#usestdin) and [`useStderr()`](#usestderr) keep returning. Annotate with `RenderOptions<InkOutputStream, InkInputStream>` when you store these options or wrap `render()` yourself.
Output stream that Ink can render to, like `process.stdout` or a stream that captures output in memory.
10
+
11
+
Only `write()` is always used. Interactive rendering and `useWindowSize()` also call `on()` and `off()`, and a stream that reports `writableLength` is expected to call the callback that Ink passes to `write()`, otherwise `waitUntilExit()` never settles.
12
+
*/
13
+
exporttypeInkOutputStream={
14
+
columns?: number;
15
+
rows?: number;
16
+
isTTY?: boolean;
17
+
destroyed?: boolean;
18
+
writable?: boolean;
19
+
writableEnded?: boolean;
20
+
writableLength?: number;
21
+
write(data: string, ...rest: unknown[]): unknown;
22
+
on?(event: unknown,listener: unknown): unknown;
23
+
off?(event: unknown,listener: unknown): unknown;
24
+
};
25
+
26
+
/**
27
+
Input stream that Ink can listen for input on, like `process.stdin`.
28
+
29
+
Every member is optional, because Ink only reads input when `isTTY` is set and a component asks for it. Handling input then calls `addListener()`, `read()`, `setRawMode()`, `setEncoding()`, `ref()` and `unref()`.
0 commit comments