@@ -19,6 +19,11 @@ import {createReactComponent} from '../../../adapter';
1919import { ChoicePickerApi } from '@a2ui/web_core/v0_9/basic_catalog' ;
2020import { LEAF_MARGIN , STANDARD_BORDER , STANDARD_RADIUS } from '../utils' ;
2121
22+ // The type of an option is deeply nested into the ChoicePickerApi schema, and
23+ // it seems z.infer is not inferring it correctly (?). We use `any` for now.
24+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25+ type _Option = any ;
26+
2227export const ChoicePicker = createReactComponent ( ChoicePickerApi , ( { props, context} ) => {
2328 const [ filter , setFilter ] = useState ( '' ) ;
2429
@@ -37,8 +42,10 @@ export const ChoicePicker = createReactComponent(ChoicePickerApi, ({props, conte
3742 } ;
3843
3944 const options = ( props . options || [ ] ) . filter (
40- ( opt : any ) =>
41- ! props . filterable || filter === '' || String ( opt . label ) . toLowerCase ( ) . includes ( filter . toLowerCase ( ) )
45+ ( opt : _Option ) =>
46+ ! props . filterable ||
47+ filter === '' ||
48+ String ( opt . label ) . toLowerCase ( ) . includes ( filter . toLowerCase ( ) )
4249 ) ;
4350
4451 const containerStyle : React . CSSProperties = {
@@ -69,7 +76,7 @@ export const ChoicePicker = createReactComponent(ChoicePickerApi, ({props, conte
6976 />
7077 ) }
7178 < div style = { listStyle } >
72- { options . map ( ( opt : any , i : number ) => {
79+ { options . map ( ( opt : _Option , i : number ) => {
7380 const isSelected = values . includes ( opt . value ) ;
7481 if ( props . displayStyle === 'chips' ) {
7582 return (
@@ -88,7 +95,7 @@ export const ChoicePicker = createReactComponent(ChoicePickerApi, ({props, conte
8895 fontSize : '12px' ,
8996 } }
9097 >
91- { opt . label as any }
98+ { opt . label }
9299 </ button >
93100 ) ;
94101 }
@@ -103,7 +110,7 @@ export const ChoicePicker = createReactComponent(ChoicePickerApi, ({props, conte
103110 onChange = { ( ) => onToggle ( opt . value ) }
104111 name = { isMutuallyExclusive ? `choice-${ context . componentModel . id } ` : undefined }
105112 />
106- < span style = { { fontSize : '14px' } } > { opt . label as any } </ span >
113+ < span style = { { fontSize : '14px' } } > { opt . label } </ span >
107114 </ label >
108115 ) ;
109116 } ) }
0 commit comments