|
1 | 1 | // @lydell/node-pty package.json does not export its types so for nodenext target we need to add them |
2 | 2 | declare module '@lydell/node-pty' { |
3 | | - interface IDisposable { |
4 | | - dispose(): void |
| 3 | + export function spawn( |
| 4 | + file: string, |
| 5 | + args: string[] | string, |
| 6 | + options: IPtyForkOptions | IWindowsPtyForkOptions, |
| 7 | + ): IPty |
| 8 | + export interface IBasePtyForkOptions { |
| 9 | + name?: string |
| 10 | + cols?: number |
| 11 | + rows?: number |
| 12 | + cwd?: string |
| 13 | + env?: { [key: string]: string | undefined } |
| 14 | + encoding?: string | null |
| 15 | + handleFlowControl?: boolean |
| 16 | + flowControlPause?: string |
| 17 | + flowControlResume?: string |
5 | 18 | } |
6 | 19 |
|
7 | | - interface IEvent<T> { |
8 | | - (listener: (e: T) => any): IDisposable |
| 20 | + export interface IPtyForkOptions extends IBasePtyForkOptions { |
| 21 | + uid?: number |
| 22 | + gid?: number |
| 23 | + } |
| 24 | + |
| 25 | + export interface IWindowsPtyForkOptions extends IBasePtyForkOptions { |
| 26 | + useConpty?: boolean |
| 27 | + useConptyDll?: boolean |
| 28 | + conptyInheritCursor?: boolean |
9 | 29 | } |
10 | 30 |
|
11 | | - interface IPty { |
| 31 | + export interface IPty { |
12 | 32 | readonly pid: number |
| 33 | + readonly cols: number |
| 34 | + readonly rows: number |
| 35 | + readonly process: string |
| 36 | + handleFlowControl: boolean |
13 | 37 | readonly onData: IEvent<string> |
14 | 38 | readonly onExit: IEvent<{ exitCode: number; signal?: number }> |
| 39 | + resize(columns: number, rows: number): void |
| 40 | + clear(): void |
15 | 41 | write(data: string | Buffer): void |
16 | 42 | kill(signal?: string): void |
| 43 | + pause(): void |
| 44 | + resume(): void |
17 | 45 | } |
18 | 46 |
|
19 | | - export function spawn( |
20 | | - file: string, |
21 | | - args: string[] | string, |
22 | | - options: { |
23 | | - name?: string |
24 | | - cols?: number |
25 | | - rows?: number |
26 | | - env?: Record<string, string | undefined> |
27 | | - }, |
28 | | - ): IPty |
| 47 | + export interface IDisposable { |
| 48 | + dispose(): void |
| 49 | + } |
| 50 | + export interface IEvent<T> { |
| 51 | + (listener: (e: T) => any): IDisposable |
| 52 | + } |
29 | 53 | } |
0 commit comments