File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @clack/prompts " : patch
3
+ ---
4
+
5
+ chore: use more accurate type to replace any in group select
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export interface GroupMultiSelectOptions<Value> extends CommonOptions {
23
23
export const groupMultiselect = < Value > ( opts : GroupMultiSelectOptions < Value > ) => {
24
24
const { selectableGroups = true , groupSpacing = 0 } = opts ;
25
25
const opt = (
26
- option : Option < Value > ,
26
+ option : Option < Value > & { group : string | boolean } ,
27
27
state :
28
28
| 'inactive'
29
29
| 'active'
@@ -33,12 +33,12 @@ export const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) =>
33
33
| 'group-active-selected'
34
34
| 'submitted'
35
35
| 'cancelled' ,
36
- options : Option < Value > [ ] = [ ]
36
+ options : ( Option < Value > & { group : string | boolean } ) [ ] = [ ]
37
37
) => {
38
38
const label = option . label ?? String ( option . value ) ;
39
- const isItem = typeof ( option as any ) . group === 'string' ;
39
+ const isItem = typeof option . group === 'string' ;
40
40
const next = isItem && ( options [ options . indexOf ( option ) + 1 ] ?? { group : true } ) ;
41
- const isLast = isItem && ( next as any ) . group === true ;
41
+ const isLast = isItem && next && next . group === true ;
42
42
const prefix = isItem ? ( selectableGroups ? `${ isLast ? S_BAR_END : S_BAR } ` : ' ' ) : '' ;
43
43
let spacingPrefix = '' ;
44
44
if ( groupSpacing > 0 && ! isItem ) {
You can’t perform that action at this time.
0 commit comments