import { checkbox, confirm, editor, expand, input, number, password, rawlist, search, select } from '@inquirer/prompts'; import type { Context, DistributiveMerge, Prettify } from '@inquirer/type'; import { Observable } from 'rxjs'; export type Answers = Record; type AsyncCallbackFunction = (...args: [error: null | undefined, value: R] | [error: Error, value: undefined]) => void; export type AsyncGetterFunction = (this: { async: () => AsyncCallbackFunction; }, answers: Prettify>) => void | R | Promise; /** * Allows to inject a custom question type into inquirer module. * * @example * ```ts * declare module 'inquirer' { * interface QuestionMap { * custom: { message: string }; * } * } * ``` * * Globally defined question types are not correct. */ export interface QuestionMap { __dummy: { message: string; }; } type KeyValueOrAsyncGetterFunction = T extends Record ? T[k] | AsyncGetterFunction : never; export type Question = { type: Type; name: string; message: string | AsyncGetterFunction; default?: any; choices?: any; filter?: (answer: any, answers: Partial) => any; askAnswered?: boolean; when?: boolean | AsyncGetterFunction; }; type QuestionWithGetters, A extends Answers> = DistributiveMerge; filter?(input: any, answers: A): any; message: KeyValueOrAsyncGetterFunction; default?: KeyValueOrAsyncGetterFunction; choices?: KeyValueOrAsyncGetterFunction; }>; export type UnnamedDistinctQuestion = QuestionWithGetters<'checkbox', Parameters[0], A> | QuestionWithGetters<'confirm', Parameters[0], A> | QuestionWithGetters<'editor', Parameters[0], A> | QuestionWithGetters<'expand', Parameters[0], A> | QuestionWithGetters<'input', Parameters[0], A> | QuestionWithGetters<'number', Parameters[0], A> | QuestionWithGetters<'password', Parameters[0], A> | QuestionWithGetters<'rawlist', Parameters[0], A> | QuestionWithGetters<'search', Parameters[0], A> | QuestionWithGetters<'list', Parameters[0], A> | QuestionWithGetters<'select', Parameters[0], A>; export type DistinctQuestion = Prettify & { name: Extract; }>; export type CustomQuestion>> = { [key in Extract]: Readonly>; }[Extract]; export type PromptSession = Question> = Q[] | Record> | Observable | Q; export type StreamOptions = Prettify; export {};