1 |
|
2 |
|
3 |
|
4 |
|
5 | import { Separator } from '@inquirer/prompts';
|
6 | import type { Prettify } 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, CustomQuestion, UnnamedDistinctQuestion, StreamOptions } from './types.js';
|
10 | import { Observable } from 'rxjs';
|
11 | export type { QuestionMap, Question, DistinctQuestion, Answers, PromptSession, } from './types.js';
|
12 | type PromptReturnType<T> = Promise<Prettify<T>> & {
|
13 | ui: PromptsRunner<Prettify<T>>;
|
14 | };
|
15 |
|
16 |
|
17 |
|
18 | export declare function createPromptModule<Prompts extends Record<string, Record<string, unknown>> = never>(opt?: StreamOptions): {
|
19 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: ((UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never, Prompts>) & {
|
20 | name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
|
21 | })[], answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
|
22 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never, Prompts>; }, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & Answers<Extract<keyof A, string>>>>;
|
23 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<(UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never, Prompts>) & {
|
24 | name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
|
25 | }>, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
|
26 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<A & PrefilledAnswers> | CustomQuestion<A & PrefilledAnswers, Prompts>) & {
|
27 | name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
|
28 | }, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
|
29 | prompts: {
|
30 | [x: string]: LegacyPromptConstructor | PromptFn<any, any>;
|
31 | };
|
32 | |
33 |
|
34 |
|
35 | registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): any;
|
36 | |
37 |
|
38 |
|
39 | restoreDefaultPrompts(): void;
|
40 | };
|
41 | declare function registerPrompt(name: string, newPrompt: LegacyPromptConstructor): void;
|
42 | declare function restoreDefaultPrompts(): void;
|
43 | declare const inquirer: {
|
44 | prompt: {
|
45 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never> & {
|
46 | name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
|
47 | })[], answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never>;
|
48 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never>; }, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & Answers<Extract<keyof A, string>> extends infer T_1 ? { [K_1 in keyof T_1]: (PrefilledAnswers & Answers<Extract<keyof A, string>>)[K_1]; } : never>;
|
49 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never> & {
|
50 | name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
|
51 | }>, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T ? { [K in keyof T]: (PrefilledAnswers & A)[K]; } : never>;
|
52 | <const A extends Answers, PrefilledAnswers extends Answers = object>(questions: UnnamedDistinctQuestion<A & PrefilledAnswers> & {
|
53 | name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
|
54 | }, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A>;
|
55 | prompts: {
|
56 | [x: string]: LegacyPromptConstructor | PromptFn<any, any>;
|
57 | };
|
58 | |
59 |
|
60 |
|
61 | registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): any;
|
62 | |
63 |
|
64 |
|
65 | restoreDefaultPrompts(): void;
|
66 | };
|
67 | ui: {
|
68 | Prompt: typeof PromptsRunner;
|
69 | };
|
70 | createPromptModule: typeof createPromptModule;
|
71 | registerPrompt: typeof registerPrompt;
|
72 | restoreDefaultPrompts: typeof restoreDefaultPrompts;
|
73 | Separator: typeof Separator;
|
74 | };
|
75 | export default inquirer;
|