mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #7225 from chrootsu/node-readline
node: signatures of module "readline" have been changed
This commit is contained in:
Vendored
+33
-6
@@ -826,22 +826,49 @@ declare module "readline" {
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
|
||||
export interface Key {
|
||||
sequence?: string;
|
||||
name?: string;
|
||||
ctrl?: boolean;
|
||||
meta?: boolean;
|
||||
shift?: boolean;
|
||||
}
|
||||
|
||||
export interface ReadLine extends events.EventEmitter {
|
||||
setPrompt(prompt: string): void;
|
||||
prompt(preserveCursor?: boolean): void;
|
||||
question(query: string, callback: Function): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
question(query: string, callback: (answer: string) => void): void;
|
||||
pause(): ReadLine;
|
||||
resume(): ReadLine;
|
||||
close(): void;
|
||||
write(data: any, key?: any): void;
|
||||
write(data: string|Buffer, key?: Key): void;
|
||||
}
|
||||
|
||||
export interface Completer {
|
||||
(line: string): CompleterResult;
|
||||
(line: string, callback: (err: any, result: CompleterResult) => void): any;
|
||||
}
|
||||
|
||||
export interface CompleterResult {
|
||||
completions: string[];
|
||||
line: string;
|
||||
}
|
||||
|
||||
export interface ReadLineOptions {
|
||||
input: NodeJS.ReadableStream;
|
||||
output: NodeJS.WritableStream;
|
||||
completer?: Function;
|
||||
output?: NodeJS.WritableStream;
|
||||
completer?: Completer;
|
||||
terminal?: boolean;
|
||||
historySize?: number;
|
||||
}
|
||||
|
||||
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine;
|
||||
export function createInterface(options: ReadLineOptions): ReadLine;
|
||||
|
||||
export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void;
|
||||
export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void;
|
||||
export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
|
||||
export function clearScreenDown(stream: NodeJS.WritableStream): void;
|
||||
}
|
||||
|
||||
declare module "vm" {
|
||||
|
||||
Reference in New Issue
Block a user