1 | declare module 'node:tty' {
|
2 | export * from 'tty';
|
3 | }
|
4 |
|
5 | declare module 'tty' {
|
6 | import * as net from 'node:net';
|
7 |
|
8 | function isatty(fd: number): boolean;
|
9 | class ReadStream extends net.Socket {
|
10 | constructor(fd: number, options?: net.SocketConstructorOpts);
|
11 | isRaw: boolean;
|
12 | setRawMode(mode: boolean): this;
|
13 | isTTY: boolean;
|
14 | }
|
15 | /**
|
16 | * -1 - to the left from cursor
|
17 | * 0 - the entire line
|
18 | * 1 - to the right from cursor
|
19 | */
|
20 | type Direction = -1 | 0 | 1;
|
21 | class WriteStream extends net.Socket {
|
22 | constructor(fd: number);
|
23 | addListener(event: string, listener: (...args: any[]) => void): this;
|
24 | addListener(event: "resize", listener: () => void): this;
|
25 |
|
26 | emit(event: string | symbol, ...args: any[]): boolean;
|
27 | emit(event: "resize"): boolean;
|
28 |
|
29 | on(event: string, listener: (...args: any[]) => void): this;
|
30 | on(event: "resize", listener: () => void): this;
|
31 |
|
32 | once(event: string, listener: (...args: any[]) => void): this;
|
33 | once(event: "resize", listener: () => void): this;
|
34 |
|
35 | prependListener(event: string, listener: (...args: any[]) => void): this;
|
36 | prependListener(event: "resize", listener: () => void): this;
|
37 |
|
38 | prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
39 | prependOnceListener(event: "resize", listener: () => void): this;
|
40 |
|
41 | /**
|
42 | * Clears the current line of this WriteStream in a direction identified by `dir`.
|
43 | */
|
44 | clearLine(dir: Direction, callback?: () => void): boolean;
|
45 | /**
|
46 | * Clears this `WriteStream` from the current cursor down.
|
47 | */
|
48 | clearScreenDown(callback?: () => void): boolean;
|
49 | /**
|
50 | * Moves this WriteStream's cursor to the specified position.
|
51 | */
|
52 | cursorTo(x: number, y?: number, callback?: () => void): boolean;
|
53 | cursorTo(x: number, callback: () => void): boolean;
|
54 | /**
|
55 | * Moves this WriteStream's cursor relative to its current position.
|
56 | */
|
57 | moveCursor(dx: number, dy: number, callback?: () => void): boolean;
|
58 | /**
|
59 | * @default `process.env`
|
60 | */
|
61 | getColorDepth(env?: {}): number;
|
62 | hasColors(depth?: number): boolean;
|
63 | hasColors(env?: {}): boolean;
|
64 | hasColors(depth: number, env?: {}): boolean;
|
65 | getWindowSize(): [number, number];
|
66 | columns: number;
|
67 | rows: number;
|
68 | isTTY: boolean;
|
69 | }
|
70 | }
|