DefinitelyTyped/types/mz/readline.d.ts
ExE Boss 6c73b9964e feat(mz): Update to v2.7 (#39277)
* feat(mz): Update to v2.7

* fix(mz): Keep support for TypeScript 2.0

* fix(mz): Add myself to the contributors list

* test(mz): Refactor tests to remove override in `.editorconfig`

* chore(mz): Remove `.editorconfig` 😡️

* fix(mz): Fix name of `dest` parameter in `fs.copyFile(…)`

* refactor(mz): Remove need for setting `"unified‑signatures": false`
2019-11-22 08:46:01 -08:00

32 lines
1.0 KiB
TypeScript

// Modified from the node.js definitions.
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/readline.d.ts
import * as readline from "readline";
export * from "readline";
export { Completer as SyncCompleter } from "readline";
export class Interface extends readline.Interface {
question(query: string, callback: (answer: string) => void): void;
question(query: string): Promise<string>;
}
// type forwarded for backwards compatibility
export type ReadLine = Interface;
export type AsyncCompleter =
((line: string, callback: (err?: null | Error, result?: readline.CompleterResult) => void) => void) |
((line: string) => Promise<readline.CompleterResult>);
export type Completer = AsyncCompleter | readline.Completer;
export interface ReadLineOptions extends readline.ReadLineOptions {
completer?: Completer;
}
export function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer,
terminal?: boolean
): Interface;
export function createInterface(options: ReadLineOptions): Interface;