1 |
|
2 |
|
3 |
|
4 | import * as readline from "readline";
|
5 | export * from "readline";
|
6 | export { Completer as SyncCompleter } from "readline";
|
7 |
|
8 | export class Interface extends readline.Interface {
|
9 | question(query: string, callback: (answer: string) => void): void;
|
10 | question(query: string): Promise<string>;
|
11 | }
|
12 |
|
13 |
|
14 | export type ReadLine = Interface;
|
15 |
|
16 | export type AsyncCompleter =
|
17 | | ((line: string, callback: (err?: null | Error, result?: readline.CompleterResult) => void) => void)
|
18 | | ((line: string) => Promise<readline.CompleterResult>);
|
19 | export type Completer = AsyncCompleter | readline.Completer;
|
20 |
|
21 | export interface ReadLineOptions extends readline.ReadLineOptions {
|
22 | completer?: Completer | undefined;
|
23 | }
|
24 |
|
25 | export function createInterface(
|
26 | input: NodeJS.ReadableStream,
|
27 | output?: NodeJS.WritableStream,
|
28 | completer?: Completer,
|
29 | terminal?: boolean,
|
30 | ): Interface;
|
31 | export function createInterface(options: ReadLineOptions): Interface;
|
32 |
|
\ | No newline at end of file |