@@ -169,18 +169,18 @@ export const confirm = (opts: ConfirmOptions) => {
169169} ;
170170
171171type Primitive = Readonly < string | boolean | number > ;
172- interface Option < Value extends Primitive > {
173- value : Value ;
174- label ?: string ;
175- hint ?: string ;
176- }
177- export interface SelectOptions < Options extends Option < Value > [ ] , Value extends Primitive > {
172+
173+ type Option < Value > = Value extends Primitive
174+ ? { value : Value ; label ?: string ; hint ?: string }
175+ : { value : Value ; label : string ; hint ?: string } ;
176+
177+ export interface SelectOptions < Options extends Option < Value > [ ] , Value > {
178178 message : string ;
179179 options : Options ;
180180 initialValue ?: Value ;
181181}
182182
183- export const select = < Options extends Option < Value > [ ] , Value extends Primitive > (
183+ export const select = < Options extends Option < Value > [ ] , Value > (
184184 opts : SelectOptions < Options , Value >
185185) => {
186186 const opt = ( option : Option < Value > , state : 'inactive' | 'active' | 'selected' | 'cancelled' ) => {
@@ -269,14 +269,14 @@ export const selectKey = <Options extends Option<Value>[], Value extends string>
269269 } ) . prompt ( ) as Promise < Value | symbol > ;
270270} ;
271271
272- export interface MultiSelectOptions < Options extends Option < Value > [ ] , Value extends Primitive > {
272+ export interface MultiSelectOptions < Options extends Option < Value > [ ] , Value > {
273273 message : string ;
274274 options : Options ;
275275 initialValues ?: Value [ ] ;
276276 required ?: boolean ;
277277 cursorAt ?: Value ;
278278}
279- export const multiselect = < Options extends Option < Value > [ ] , Value extends Primitive > (
279+ export const multiselect = < Options extends Option < Value > [ ] , Value > (
280280 opts : MultiSelectOptions < Options , Value >
281281) => {
282282 const opt = (
@@ -387,14 +387,14 @@ export const multiselect = <Options extends Option<Value>[], Value extends Primi
387387 } ) . prompt ( ) as Promise < Value [ ] | symbol > ;
388388} ;
389389
390- export interface GroupMultiSelectOptions < Options extends Option < Value > [ ] , Value extends Primitive > {
390+ export interface GroupMultiSelectOptions < Options extends Option < Value > [ ] , Value > {
391391 message : string ;
392392 options : Record < string , Options > ;
393393 initialValues ?: Value [ ] ;
394394 required ?: boolean ;
395395 cursorAt ?: Value ;
396396}
397- export const groupMultiselect = < Options extends Option < Value > [ ] , Value extends Primitive > (
397+ export const groupMultiselect = < Options extends Option < Value > [ ] , Value > (
398398 opts : GroupMultiSelectOptions < Options , Value >
399399) => {
400400 const opt = (
0 commit comments