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 {
2323export const groupMultiselect = < Value > ( opts : GroupMultiSelectOptions < Value > ) => {
2424 const { selectableGroups = true , groupSpacing = 0 } = opts ;
2525 const opt = (
26- option : Option < Value > ,
26+ option : Option < Value > & { group : string | boolean } ,
2727 state :
2828 | 'inactive'
2929 | 'active'
@@ -33,12 +33,12 @@ export const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) =>
3333 | 'group-active-selected'
3434 | 'submitted'
3535 | 'cancelled' ,
36- options : Option < Value > [ ] = [ ]
36+ options : ( Option < Value > & { group : string | boolean } ) [ ] = [ ]
3737 ) => {
3838 const label = option . label ?? String ( option . value ) ;
39- const isItem = typeof ( option as any ) . group === 'string' ;
39+ const isItem = typeof option . group === 'string' ;
4040 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 ;
4242 const prefix = isItem ? ( selectableGroups ? `${ isLast ? S_BAR_END : S_BAR } ` : ' ' ) : '' ;
4343 let spacingPrefix = '' ;
4444 if ( groupSpacing > 0 && ! isItem ) {
You can’t perform that action at this time.
0 commit comments