Skip to content

Commit

Permalink
fix: correct and improve return types for single and multi select pro…
Browse files Browse the repository at this point in the history
…mpts (#197)
  • Loading branch information
DamianGlowala committed Jun 26, 2023
1 parent dabb705 commit 0d03d70
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/prompt.ts
Expand Up @@ -21,7 +21,7 @@ export type ConfirmOptions = {
export type SelectOptions = {
type: "select";
initial?: string;
options: (SelectOption | string)[];
options: (string | SelectOption)[];
};

export type MultiSelectOptions = {
Expand All @@ -41,7 +41,11 @@ type inferPromptReturnType<T extends PromptOptions> = T extends TextOptions
? string
: T extends ConfirmOptions
? boolean
: string[];
: T extends SelectOptions
? T["options"][number]
: T extends MultiSelectOptions
? T["options"]
: unknown;

export async function prompt<
_ = any,
Expand Down

0 comments on commit 0d03d70

Please sign in to comment.