@@ -174,16 +174,14 @@ type Option<Value> = Value extends Primitive
174174 ? { value : Value ; label ?: string ; hint ?: string }
175175 : { value : Value ; label : string ; hint ?: string } ;
176176
177- export interface SelectOptions < Options extends Option < Value > [ ] , Value > {
177+ export interface SelectOptions < Value > {
178178 message : string ;
179- options : Options ;
179+ options : Option < Value > [ ] ;
180180 initialValue ?: Value ;
181181 maxItems ?: number ;
182182}
183183
184- export const select = < Options extends Option < Value > [ ] , Value > (
185- opts : SelectOptions < Options , Value >
186- ) => {
184+ export const select = < Value > ( opts : SelectOptions < Value > ) => {
187185 const opt = ( option : Option < Value > , state : 'inactive' | 'active' | 'selected' | 'cancelled' ) => {
188186 const label = option . label ?? String ( option . value ) ;
189187 if ( state === 'active' ) {
@@ -253,9 +251,7 @@ export const select = <Options extends Option<Value>[], Value>(
253251 } ) . prompt ( ) as Promise < Value | symbol > ;
254252} ;
255253
256- export const selectKey = < Options extends Option < Value > [ ] , Value extends string > (
257- opts : SelectOptions < Options , Value >
258- ) => {
254+ export const selectKey = < Value extends string > ( opts : SelectOptions < Value > ) => {
259255 const opt = (
260256 option : Option < Value > ,
261257 state : 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive'
@@ -301,16 +297,14 @@ export const selectKey = <Options extends Option<Value>[], Value extends string>
301297 } ) . prompt ( ) as Promise < Value | symbol > ;
302298} ;
303299
304- export interface MultiSelectOptions < Options extends Option < Value > [ ] , Value > {
300+ export interface MultiSelectOptions < Value > {
305301 message : string ;
306- options : Options ;
302+ options : Option < Value > [ ] ;
307303 initialValues ?: Value [ ] ;
308304 required ?: boolean ;
309305 cursorAt ?: Value ;
310306}
311- export const multiselect = < Options extends Option < Value > [ ] , Value > (
312- opts : MultiSelectOptions < Options , Value >
313- ) => {
307+ export const multiselect = < Value > ( opts : MultiSelectOptions < Value > ) => {
314308 const opt = (
315309 option : Option < Value > ,
316310 state : 'inactive' | 'active' | 'selected' | 'active-selected' | 'submitted' | 'cancelled'
@@ -419,16 +413,14 @@ export const multiselect = <Options extends Option<Value>[], Value>(
419413 } ) . prompt ( ) as Promise < Value [ ] | symbol > ;
420414} ;
421415
422- export interface GroupMultiSelectOptions < Options extends Option < Value > [ ] , Value > {
416+ export interface GroupMultiSelectOptions < Value > {
423417 message : string ;
424- options : Record < string , Options > ;
418+ options : Record < string , Option < Value > [ ] > ;
425419 initialValues ?: Value [ ] ;
426420 required ?: boolean ;
427421 cursorAt ?: Value ;
428422}
429- export const groupMultiselect = < Options extends Option < Value > [ ] , Value > (
430- opts : GroupMultiSelectOptions < Options , Value >
431- ) => {
423+ export const groupMultiselect = < Value > ( opts : GroupMultiSelectOptions < Value > ) => {
432424 const opt = (
433425 option : Option < Value > ,
434426 state :
0 commit comments