Skip to content

Commit 44d92f8

Browse files
te6-inclaude
andcommitted
fix(segmented-control): type SegmentedControlItem with its declared props interface
The forwardRef generic used the narrow UseSegmentedControlItemProps instead of the SegmentedControlItemProps interface declared right above, rejecting children/className/asChild at the type level while the runtime always spread them. No runtime change. Same fix as #1775; kept as a standalone commit so a rebase onto dev drops it automatically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 3490b81 commit 44d92f8

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

packages/react-headless/segmented-control/src/SegmentedControl.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,20 @@ export interface SegmentedControlItemProps
4848
PrimitiveProps,
4949
Omit<React.InputHTMLAttributes<HTMLLabelElement>, "value"> {}
5050

51-
export const SegmentedControlItem = React.forwardRef<
52-
HTMLLabelElement,
53-
UseSegmentedControlItemProps
54-
>((props, ref) => {
55-
const { value, invalid, disabled, ...otherProps } = props;
56-
const { getItemProps } = useSegmentedControlContext();
57-
const itemProps = getItemProps({ value, disabled, invalid });
58-
const mergedProps = mergeProps(itemProps.rootProps, otherProps);
51+
export const SegmentedControlItem = React.forwardRef<HTMLLabelElement, SegmentedControlItemProps>(
52+
(props, ref) => {
53+
const { value, invalid, disabled, ...otherProps } = props;
54+
const { getItemProps } = useSegmentedControlContext();
55+
const itemProps = getItemProps({ value, disabled, invalid });
56+
const mergedProps = mergeProps(itemProps.rootProps, otherProps);
5957

60-
return (
61-
<SegmentedControlItemProvider value={itemProps}>
62-
<Primitive.label ref={ref} {...mergedProps} />
63-
</SegmentedControlItemProvider>
64-
);
65-
});
58+
return (
59+
<SegmentedControlItemProvider value={itemProps}>
60+
<Primitive.label ref={ref} {...mergedProps} />
61+
</SegmentedControlItemProvider>
62+
);
63+
},
64+
);
6665
SegmentedControlItem.displayName = "SegmentedControlItem";
6766

6867
export interface SegmentedControlItemHiddenInputProps

0 commit comments

Comments
 (0)