import { Question, QuestionCollection } from 'inquirer'; import { PinionContext, Callable } from '../core.js'; /** * Get the type from an Inquirer question */ export type AnswerType = Q extends { type: 'input'; } ? string : Q extends { type: 'list'; } ? string : Q extends { type: 'rawlist'; } ? string : Q extends { type: 'number'; } ? number : Q extends { type: 'password'; } ? string : Q extends { type: 'confirm'; } ? boolean : Q extends { type: 'checkbox'; } ? string[] : Q extends { type: 'editor'; } ? string : unknown; /** * Get the types for the answers from a prompt() function */ export type AnswerTypes = Q extends ReadonlyArray ? { [K in Q[number] as K['name']]: AnswerType; } : Q extends { [key: string]: Question; } ? { [K in keyof Q]: AnswerType; } : unknown; /** * Show prompts using Inquirer * * @param prompts The prompt questions to ask * @returns The generator context updated with the prompt results */ export declare const prompt: (prompts: Callable) => (ctx: C) => Promise>; /** * Get the types for the answers from a prompt() function */ export type Answers> = ReturnType extends Promise ? U : never;