@@ -38,6 +38,7 @@ import {
3838 type MultiSelectSortingProps ,
3939 sortingPropTypes ,
4040} from './MultiSelectPropTypes' ;
41+ import { isSelectAllItem } from './tools/isSelectAllItem' ;
4142import ListBox , {
4243 ListBoxSizePropType ,
4344 ListBoxTypePropType ,
@@ -52,7 +53,7 @@ import { match, keys } from '../../internal/keyboard';
5253import { mergeRefs } from '../../tools/mergeRefs' ;
5354import { deprecate } from '../../prop-types/deprecate' ;
5455import { useId } from '../../internal/useId' ;
55- import { defaultSortItems , defaultCompareItems } from './tools/sorting' ;
56+ import { defaultCompareItems , defaultSortItems } from './tools/sorting' ;
5657import { usePrefix } from '../../internal/usePrefix' ;
5758import { FormContext } from '../FluidForm' ;
5859import { useSelection } from '../../internal/Selection' ;
@@ -385,12 +386,10 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
385386 ) ;
386387
387388 const nonSelectAllItems = useMemo (
388- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
389- ( ) => filteredItems . filter ( ( item ) => ! ( item as any ) . isSelectAll ) ,
389+ ( ) => filteredItems . filter ( ( item ) => ! isSelectAllItem ( item ) ) ,
390390 [ filteredItems ]
391391 ) ;
392- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
393- const selectAll = filteredItems . some ( ( item ) => ( item as any ) . isSelectAll ) ;
392+ const selectAll = filteredItems . some ( isSelectAllItem ) ;
394393
395394 const {
396395 selectedItems : controlledSelectedItems ,
@@ -498,8 +497,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
498497
499498 // memoize sorted items to reduce unnecessary expensive sort on rerender
500499 const sortedItems = useMemo ( ( ) => {
501- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
502- const selectAllItem = items . find ( ( item ) => ( item as any ) . isSelectAll ) ;
500+ const selectAllItem = items . find ( isSelectAllItem ) ;
503501
504502 const selectableRealItems = nonSelectAllItems . filter (
505503 // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
@@ -697,7 +695,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
697695 return changes ;
698696 }
699697 if ( changes . selectedItem && changes . selectedItem . disabled !== true ) {
700- if ( changes . selectedItem . isSelectAll ) {
698+ if ( isSelectAllItem ( changes . selectedItem ) ) {
701699 handleSelectAllClick ( ) ;
702700 } else {
703701 onItemChange ( changes . selectedItem ) ;
@@ -707,7 +705,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
707705
708706 return { ...changes , highlightedIndex : state . highlightedIndex } ;
709707 case ItemClick :
710- if ( changes . selectedItem . isSelectAll ) {
708+ if ( isSelectAllItem ( changes . selectedItem ) ) {
711709 handleSelectAllClick ( ) ;
712710 } else {
713711 onItemChange ( changes . selectedItem ) ;
@@ -842,8 +840,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
842840
843841 // exclude the select-all item from the count
844842 const selectedItemsLength = controlledSelectedItems . filter (
845- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
846- ( item : any ) => ! ( item as any ) . isSelectAll
843+ ( item ) => ! isSelectAllItem ( item )
847844 ) . length ;
848845
849846 const className = cx (
@@ -1083,8 +1080,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
10831080 ? sortedItems . map ( ( item , index ) => {
10841081 let isChecked : boolean ;
10851082 let isIndeterminate = false ;
1086- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
1087- if ( ( item as any ) . isSelectAll ) {
1083+ if ( isSelectAllItem ( item ) ) {
10881084 isChecked = selectAllStatus . checked ;
10891085 isIndeterminate = selectAllStatus . indeterminate ;
10901086 } else {
@@ -1114,7 +1110,7 @@ export const FilterableMultiSelect = forwardRef(function FilterableMultiSelect<
11141110 key = { itemProps . id }
11151111 aria-label = { itemText }
11161112 aria-checked = { isIndeterminate ? 'mixed' : isChecked }
1117- isActive = { isChecked && ! item [ 'isSelectAll' ] }
1113+ isActive = { isChecked && ! isSelectAllItem ( item ) }
11181114 isHighlighted = { highlightedIndex === index }
11191115 title = { itemText }
11201116 disabled = { disabled }
0 commit comments