Skip to content

Commit

Permalink
Fix SelectPrompt options type
Browse files Browse the repository at this point in the history
  • Loading branch information
kevduc committed Aug 24, 2023
1 parent 7c7fde8 commit 5dbe785
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/prompts/select.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { NonEmptyArray } from '../utility-types';
import Prompt, { PromptOptions } from './prompt';

interface SelectOptions<T extends { value: any }> extends PromptOptions<SelectPrompt<T>> {
options: T[];
options: NonEmptyArray<T>;
initialValue?: T['value'];
}
export default class SelectPrompt<T extends { value: any }> extends Prompt {
options: T[];
options: SelectOptions<T>['options'];
cursor: number = 0;

private get _value() {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utility-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type NonEmptyArray<T> = [T, ...T[]];

0 comments on commit 5dbe785

Please sign in to comment.