1 |
|
2 |
|
3 |
|
4 |
|
5 | import { Separator } from '@inquirer/prompts';
|
6 | import type { Prettify, UnionToIntersection } from '@inquirer/type';
|
7 | import { default as PromptsRunner } from './ui/prompt.js';
|
8 | import type { LegacyPromptConstructor, PromptFn } from './ui/prompt.js';
|
9 | import type { Answers, Question, QuestionAnswerMap, QuestionObservable, StreamOptions } from './types.js';
|
10 | export type { QuestionMap } from './types.js';
|
11 | type PromptReturnType<T> = (Promise<Prettify<T>> & {
|
12 | ui: PromptsRunner<Prettify<T>>;
|
13 | }) | never;
|
14 |
|
15 |
|
16 |
|
17 | export declare function createPromptModule(opt?: StreamOptions): {
|
18 | <const AnswerList extends readonly Answers[], PrefilledAnswers extends Answers = object>(questions: { [I in keyof AnswerList]: Question<PrefilledAnswers & AnswerList[I]>; }, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & UnionToIntersection<AnswerList[number]>>;
|
19 | <const Map extends QuestionAnswerMap<A>, const A extends Answers<Extract<keyof Map, string>>, PrefilledAnswers extends Answers = object>(questions: Map, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
20 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: QuestionObservable<A>, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
21 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Question<A>, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
22 | prompts: {
|
23 | [x: string]: LegacyPromptConstructor | PromptFn<any, any>;
|
24 | };
|
25 | |
26 |
|
27 |
|
28 | registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): any;
|
29 | |
30 |
|
31 |
|
32 | restoreDefaultPrompts(): void;
|
33 | };
|
34 | declare function registerPrompt(name: string, newPrompt: LegacyPromptConstructor): void;
|
35 | declare function restoreDefaultPrompts(): void;
|
36 | declare const inquirer: {
|
37 | prompt: {
|
38 | <const AnswerList extends readonly Answers[], PrefilledAnswers extends Answers = object>(questions: { [I in keyof AnswerList]: Question<PrefilledAnswers & AnswerList[I]>; }, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & UnionToIntersection<AnswerList[number]>>;
|
39 | <const Map extends QuestionAnswerMap<A>, const A extends Answers<Extract<keyof Map, string>>, PrefilledAnswers extends Answers = object>(questions: Map, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
40 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: QuestionObservable<A>, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
41 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Question<A>, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
42 | prompts: {
|
43 | [x: string]: LegacyPromptConstructor | PromptFn<any, any>;
|
44 | };
|
45 | |
46 |
|
47 |
|
48 | registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): any;
|
49 | |
50 |
|
51 |
|
52 | restoreDefaultPrompts(): void;
|
53 | };
|
54 | ui: {
|
55 | Prompt: typeof PromptsRunner;
|
56 | };
|
57 | createPromptModule: typeof createPromptModule;
|
58 | registerPrompt: typeof registerPrompt;
|
59 | restoreDefaultPrompts: typeof restoreDefaultPrompts;
|
60 | Separator: typeof Separator;
|
61 | };
|
62 | export default inquirer;
|