UNPKG

2.35 kBTypeScriptView Raw
1export declare enum Interfaces {
2 Terminal = "terminal",
3 Slack = "slack"
4}
5export interface APIError {
6}
7export interface APIResponse<T> {
8 data: T;
9 error?: APIError[];
10}
11export declare type Questions<A extends Answers = Answers> = Question<A> | Question<A>[] | ReadonlyArray<Question<A>>;
12export declare type Answers = Record<string, any>;
13interface QuestionCommon<A> {
14 /**
15 * The name to use when storing the answer in the answers hash.
16 * If the name contains periods, it will define a path in the answers hash.
17 */
18 name: string;
19 /**
20 * The question to print. If defined as a function, the first parameter will be
21 * the current inquirer session answers.
22 * Defaults to the value of `name` (followed by a colon).
23 */
24 message: string;
25 flag?: string;
26}
27export declare type Question<A extends Answers = Answers> = InputQuestion<A> | NumberQuestion<A> | SecretQuestion<A> | PasswordQuestion<A> | ConfirmQuestion<A> | ListQuestion<A> | AutoCompleteQuestion<A> | CheckboxQuestion<A> | EditorQuestion<A> | DateTimeQuestion<A>;
28interface InputQuestion<A> extends QuestionCommon<A> {
29 type: 'input';
30 default?: string;
31 allowEmpty?: boolean;
32}
33interface NumberQuestion<A> extends QuestionCommon<A> {
34 type: 'number';
35 default?: number;
36 minimum?: number;
37 maximum?: number;
38}
39interface SecretQuestion<A> extends QuestionCommon<A> {
40 type: 'secret';
41}
42interface PasswordQuestion<A> extends QuestionCommon<A> {
43 type: 'password';
44 confirm?: boolean;
45}
46interface ConfirmQuestion<A> extends QuestionCommon<A> {
47 type: 'confirm';
48 default?: boolean;
49}
50interface ListQuestion<A> extends QuestionCommon<A> {
51 type: 'list';
52 choices: string[];
53 default?: string | number;
54}
55interface AutoCompleteQuestion<A> extends QuestionCommon<A> {
56 type: 'autocomplete';
57 choices: string[];
58 default?: string | number;
59}
60interface CheckboxQuestion<A> extends QuestionCommon<A> {
61 type: 'checkbox';
62 choices: string[];
63}
64interface EditorQuestion<A> extends QuestionCommon<A> {
65 type: 'editor';
66 default?: string | number;
67}
68interface DateTimeQuestion<A> extends QuestionCommon<A> {
69 type: 'datetime';
70 variant?: 'date' | 'time' | 'datetime';
71 default?: string | Date;
72 minimum?: string | Date;
73 maximum?: string | Date;
74}
75export {};