Typescript doesn't show which prop should be provided

My component looks like this:
const ToggleGroup = React.forwardRef<
HTMLDivElement,
React.ComponentPropsWithRef<typeof RadixToggleGroup.Root> & {
children: React.ReactNode;
}
>(({ children, ...rest }, passedRef) => (
<RadixToggleGroup.Root {...rest} ref={passedRef}>
{children}
</RadixToggleGroup.Root>
));
const ToggleGroup = React.forwardRef<
HTMLDivElement,
React.ComponentPropsWithRef<typeof RadixToggleGroup.Root> & {
children: React.ReactNode;
}
>(({ children, ...rest }, passedRef) => (
<RadixToggleGroup.Root {...rest} ref={passedRef}>
{children}
</RadixToggleGroup.Root>
));
The above comp requires a type prop to be provided but typescript doesnt tell me so as shown in the error (image below). Am I doing something wrong or is this intended behavior ?
2 Replies
KP
KPOP2y ago
This is what I expect ts to show
Julien Castets
brmzkw
CodeSandbox
busy-snow-w9od4k - CodeSandbox
busy-snow-w9od4k by brmzkw using @radix-ui/react-popover, @radix-ui/react-toggle-group, react, react-dom, react-scripts
Want results from more Discord servers?
Add your server