Skip to content

Commit

Permalink
Fix select option type
Browse files Browse the repository at this point in the history
  • Loading branch information
kevduc committed Aug 17, 2023
1 parent c215fa5 commit 36cd1ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export { default as SelectPrompt } from './prompts/select';
export { default as SelectKeyPrompt } from './prompts/select-key';
export { default as TextPrompt } from './prompts/text';
export { block } from './utils';
export type { NonEmptyArray } from './utility-types';
3 changes: 2 additions & 1 deletion packages/prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
GroupMultiSelectPrompt,
isCancel,
MultiSelectPrompt,
NonEmptyArray,
PasswordPrompt,
SelectKeyPrompt,
SelectPrompt,
Expand Down Expand Up @@ -181,7 +182,7 @@ export interface SelectOptions<Options extends Option<Value>[], Value> {
maxItems?: number;
}

export const select = <Options extends Option<Value>[], Value>(
export const select = <Options extends NonEmptyArray<Option<Value>>, Value>(
opts: SelectOptions<Options, Value>
) => {
const opt = (option: Option<Value>, state: 'inactive' | 'active' | 'selected' | 'cancelled') => {
Expand Down

0 comments on commit 36cd1ad

Please sign in to comment.