/** * @module dynamiclist */ import type Choice from 'inquirer/lib/objects/choice'; import InquirerList = require('inquirer/lib/prompts/list'); import UI = require('inquirer/lib/ui/baseUI'); declare class DynamicList extends InquirerList { options: ConstructorParameters[0] & { emptyMessage: string; }; ui: UI; /** * @summary Dynamic list widget * @name DynamicList * @class * @public * * @param {Object} [options] - options * @param {Object[]} options.choices - initial choices * @param {String} options.message - widget message * @param {String} [options.emptyMessage='No options'] - message for when no choices * * @example * list = new DynamicList * message: 'Foo' * emptyMessage: 'Nothing to show' * choices: [ * name: 'Foo' * value: 'foo' * ] * * # Run the list widget * list.run().then (answer) -> * console.log(answer) * * # You can add new choices on the fly * list.addChoice * name: 'Bar' * value: 'bar' * * # We re-render to be able to see the new options * list.render() */ constructor(options: ConstructorParameters[0] & { emptyMessage?: string; }); isEmpty(): boolean; onSubmit(...args: Parameters): void; render(...args: Parameters): void; addChoice(choice: Pick & Partial): number; removeChoice(choice: Pick & Partial): void; run(): Promise; } export default DynamicList;