Skip to content

PromptAutocompleteQuestion

@tsed/cli-prompts

Usage

typescript
import { PromptAutocompleteQuestion } from "@tsed/cli-prompts";

See /packages/cli-prompts/src/interfaces/PromptQuestion.ts.

Overview

ts
interface PromptAutocompleteQuestion<Value = any> extends PromptBaseQuestion<Value>, Omit<AutocompleteOptions<Value>, "message" | "options" | "filter"> {
    type: "autocomplete";
    source?: (answers: Record<string, any>) => MaybePromise<PromptChoice<Value>[]>;
    choices?: string[] | PromptChoiceInput<Value>[];
}

Description

Searchable prompt that fetches choices dynamically.

type

ts
type: "autocomplete";

source:

ts
source?: (answers: Record<string, any>) => MaybePromise<PromptChoice<Value>[]>;

Async loader returning the set of choices filtered by the keyword.

choices

ts
choices?: string[] | PromptChoiceInput<Value>[];

Available choices displayed to the user.

Released under the MIT License.