///
import { EventEmitter } from "events";
import { ReadStream, WriteStream } from "tty";
import "revalidator";
declare namespace prompt {
type GetCallback = (err: Error | null, result: T) => void;
type AddCallback = (err: Error | null) => void;
type AskFunction = () => boolean;
type BeforeFunction = (line: string) => string;
type RevalidatorSchema = Partial> & {
ask?: AskFunction | undefined;
before?: BeforeFunction | undefined;
name?: string | undefined;
raw?: [string, string] | undefined;
hidden?: boolean;
replace?: string;
};
interface Properties {
[name: string]: RevalidatorSchema | string;
}
interface Schema {
properties: Properties;
}
interface History {
property: RevalidatorSchema | string;
value: string;
}
interface StartOptions {
allowEmpty?: boolean | undefined;
colors?: boolean | undefined;
delimiter?: string | undefined;
memory?: number | undefined;
message?: string | undefined;
noHandleSIGINT?: boolean | undefined;
stdin?: ReadStream | undefined;
stdout?: WriteStream | undefined;
}
}
declare class prompt extends EventEmitter {
on(event: "invalid", listener: (prop: prompt.RevalidatorSchema | string, line: number) => void): this;
on(event: "prompt", listener: (prop: prompt.RevalidatorSchema | string) => void): this;
on(event: "pause" | "resume" | "SIGINT" | "start" | "stop", listener: () => void): this;
static colors: boolean;
static delimiter: string;
static message: string;
static override?: any;
static version: string;
static addProperties(obj: any, values: Array): Promise;
static addProperties(
obj: any,
values: Array,
callback: prompt.GetCallback,
): void;
static get(
values: Array | prompt.Schema | prompt.RevalidatorSchema,
): Promise;
static get(
values: Array | prompt.Schema | prompt.RevalidatorSchema,
callback: prompt.GetCallback,
): void;
static history(name?: string | number): prompt.History | null;
static start(options?: prompt.StartOptions): void;
static stop(): void;
}
export = prompt;