export interface Value { name: string; value: boolean; } export interface OptionValue { name: string; value: any; selected?: boolean; } export interface Validation { type?: string; success: boolean; reason?: string; } export interface BaseQuestion { name: string; type: string; _?: boolean; alias?: string | string[]; default?: any; defaultFrom?: string; setFrom?: string; optionsFrom?: string; useDefault?: boolean; required?: boolean; message?: string; description?: string; validate?: (input: any, obj: any) => Validation | boolean; sanitize?: (input: any, obj: any) => any; pattern?: string; dependsOn?: string[]; when?: (answers: any) => boolean; skipPrompt?: boolean; } export interface ConfirmQuestion extends BaseQuestion { type: 'confirm'; default?: boolean; } export interface BooleanQuestion extends BaseQuestion { type: 'boolean'; default?: boolean; } export interface JsonQuestion extends BaseQuestion { type: 'json'; default?: Record; } export interface AutocompleteQuestion extends BaseQuestion { type: 'autocomplete'; options: (string | OptionValue)[]; maxDisplayLines?: number; allowCustomOptions?: boolean; } export interface ListQuestion extends BaseQuestion { type: 'list'; options: (string | OptionValue)[]; maxDisplayLines?: number; allowCustomOptions?: boolean; } export interface CheckboxQuestion extends BaseQuestion { type: 'checkbox'; options: (string | OptionValue)[]; maxDisplayLines?: number; returnFullResults?: boolean; allowCustomOptions?: boolean; default?: string[]; } export interface TextQuestion extends BaseQuestion { type: 'text'; default?: string; } export interface NumberQuestion extends BaseQuestion { type: 'number'; default?: number; } export interface PasswordQuestion extends BaseQuestion { type: 'password'; mask?: string; } export type Question = ConfirmQuestion | BooleanQuestion | JsonQuestion | ListQuestion | AutocompleteQuestion | CheckboxQuestion | TextQuestion | NumberQuestion | PasswordQuestion;