Skip to content

Commit 7b0ea79

Browse files
committed
Fix any lints
1 parent 092e403 commit 7b0ea79

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

renderers/react/src/v0_9/catalog/basic/components/ChoicePicker.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ import {createReactComponent} from '../../../adapter';
1919
import {ChoicePickerApi} from '@a2ui/web_core/v0_9/basic_catalog';
2020
import {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+
2227
export 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
})}

renderers/react/src/v0_9/catalog/basic/components/Tabs.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import {createReactComponent} from '../../../adapter';
1919
import {TabsApi} from '@a2ui/web_core/v0_9/basic_catalog';
2020
import {LEAF_MARGIN} from '../utils';
2121

22-
// Individual tabs types are dynamic due to core schema, so we type as any in iteration.
22+
// The type of a tab is deeply nested into the TabsApi 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 _Tab = any;
2326

2427
export const Tabs = createReactComponent(TabsApi, ({props, buildChild}) => {
2528
const [selectedIndex, setSelectedIndex] = useState(0);
@@ -30,7 +33,7 @@ export const Tabs = createReactComponent(TabsApi, ({props, buildChild}) => {
3033
return (
3134
<div style={{display: 'flex', flexDirection: 'column', width: '100%', margin: LEAF_MARGIN}}>
3235
<div style={{display: 'flex', borderBottom: '1px solid #ccc', marginBottom: '8px'}}>
33-
{tabs.map((tab: any, i: number) => (
36+
{tabs.map((tab: _Tab, i: number) => (
3437
<button
3538
key={i}
3639
onClick={() => setSelectedIndex(i)}
@@ -45,7 +48,7 @@ export const Tabs = createReactComponent(TabsApi, ({props, buildChild}) => {
4548
color: selectedIndex === i ? 'var(--a2ui-primary-color, #007bff)' : 'inherit',
4649
}}
4750
>
48-
{tab.title as any}
51+
{tab.title}
4952
</button>
5053
))}
5154
</div>

0 commit comments

Comments
 (0)