@@ -174,15 +174,13 @@ type Option<Value> = Value extends Primitive
174
174
? { value : Value ; label ?: string ; hint ?: string }
175
175
: { value : Value ; label : string ; hint ?: string } ;
176
176
177
- export interface SelectOptions < Options extends Option < Value > [ ] , Value > {
177
+ export interface SelectOptions < Value > {
178
178
message : string ;
179
- options : Options ;
179
+ options : Option < Value > [ ] ;
180
180
initialValue ?: Value ;
181
181
}
182
182
183
- export const select = < Options extends Option < Value > [ ] , Value > (
184
- opts : SelectOptions < Options , Value >
185
- ) => {
183
+ export const select = < Value > ( opts : SelectOptions < Value > ) => {
186
184
const opt = ( option : Option < Value > , state : 'inactive' | 'active' | 'selected' | 'cancelled' ) => {
187
185
const label = option . label ?? String ( option . value ) ;
188
186
if ( state === 'active' ) {
@@ -221,9 +219,7 @@ export const select = <Options extends Option<Value>[], Value>(
221
219
} ) . prompt ( ) as Promise < Value | symbol > ;
222
220
} ;
223
221
224
- export const selectKey = < Options extends Option < Value > [ ] , Value extends string > (
225
- opts : SelectOptions < Options , Value >
226
- ) => {
222
+ export const selectKey = < Value extends string > ( opts : SelectOptions < Value > ) => {
227
223
const opt = (
228
224
option : Option < Value > ,
229
225
state : 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive'
@@ -269,16 +265,14 @@ export const selectKey = <Options extends Option<Value>[], Value extends string>
269
265
} ) . prompt ( ) as Promise < Value | symbol > ;
270
266
} ;
271
267
272
- export interface MultiSelectOptions < Options extends Option < Value > [ ] , Value > {
268
+ export interface MultiSelectOptions < Value > {
273
269
message : string ;
274
- options : Options ;
270
+ options : Option < Value > [ ] ;
275
271
initialValues ?: Value [ ] ;
276
272
required ?: boolean ;
277
273
cursorAt ?: Value ;
278
274
}
279
- export const multiselect = < Options extends Option < Value > [ ] , Value > (
280
- opts : MultiSelectOptions < Options , Value >
281
- ) => {
275
+ export const multiselect = < Value > ( opts : MultiSelectOptions < Value > ) => {
282
276
const opt = (
283
277
option : Option < Value > ,
284
278
state : 'inactive' | 'active' | 'selected' | 'active-selected' | 'submitted' | 'cancelled'
@@ -387,16 +381,14 @@ export const multiselect = <Options extends Option<Value>[], Value>(
387
381
} ) . prompt ( ) as Promise < Value [ ] | symbol > ;
388
382
} ;
389
383
390
- export interface GroupMultiSelectOptions < Options extends Option < Value > [ ] , Value > {
384
+ export interface GroupMultiSelectOptions < Value > {
391
385
message : string ;
392
- options : Record < string , Options > ;
386
+ options : Record < string , Option < Value > [ ] > ;
393
387
initialValues ?: Value [ ] ;
394
388
required ?: boolean ;
395
389
cursorAt ?: Value ;
396
390
}
397
- export const groupMultiselect = < Options extends Option < Value > [ ] , Value > (
398
- opts : GroupMultiSelectOptions < Options , Value >
399
- ) => {
391
+ export const groupMultiselect = < Value > ( opts : GroupMultiSelectOptions < Value > ) => {
400
392
const opt = (
401
393
option : Option < Value > ,
402
394
state :
0 commit comments