Skip to content

Commit

Permalink
non empty array for GroupMultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
kevduc authored and natemoo-re committed Dec 21, 2024
1 parent ac7e8f4 commit fc8337f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/prompts/group-multiselect.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { NonEmptyArray } from '../utility-types';
import Prompt, { type PromptOptions } from './prompt';

interface GroupMultiSelectOptions<T extends { value: any }>
extends PromptOptions<GroupMultiSelectPrompt<T>> {
options: Record<string, T[]>;
options: Record<string, NonEmptyArray<T>>;
initialValues?: T['value'][];
required?: boolean;
cursorAt?: T['value'];
}
export default class GroupMultiSelectPrompt<T extends { value: any }> extends Prompt {
options: (T & { group: string | boolean })[];
options: NonEmptyArray<T & { group: string | boolean }>;
cursor = 0;

getGroupItems(group: string): T[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {

export interface GroupMultiSelectOptions<Value> {
message: string;
options: Record<string, Option<Value>[]>;
options: Record<string, NonEmptyArray<Option<Value>>>;
initialValues?: Value[];
required?: boolean;
cursorAt?: Value;
Expand Down

0 comments on commit fc8337f

Please sign in to comment.