Skip to content

Commit

Permalink
non empty array for multiselect
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 d6da149 commit ac7e8f4
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/multi-select.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { NonEmptyArray } from '../utility-types';
import Prompt, { type PromptOptions } from './prompt';

interface MultiSelectOptions<T extends { value: any }> extends PromptOptions<MultiSelectPrompt<T>> {
options: T[];
options: MultiSelectPrompt<T>['options'];
initialValues?: T['value'][];
required?: boolean;
cursorAt?: T['value'];
}
export default class MultiSelectPrompt<T extends { value: any }> extends Prompt {
options: T[];
options: NonEmptyArray<T>;
cursor = 0;

private get _value() {
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 @@ -314,7 +314,7 @@ export const selectKey = <Value extends string>(opts: SelectOptions<Value>) => {

export interface MultiSelectOptions<Value> {
message: string;
options: Option<Value>[];
options: NonEmptyArray<Option<Value>>;
initialValues?: Value[];
maxItems?: number;
required?: boolean;
Expand Down

0 comments on commit ac7e8f4

Please sign in to comment.