The typescript compiler in VSCode, currently at TypeScript React 4.4.2
points to a TS(2339)
error: Property 'Col' does not exist on type 'FC<GridProps>'.
I've tried adding this prop to GridProps
:
export type GridProps = {
children: ReactNode;
className?: string;
Col: JSX.Element;
};
But the error still shows. I think this is because the Grid
component is not initialized. I've seen this convention of extending a main component with other uninitialized components such as Grid.Col = Col
(see the screenshot), and it actually works when it is implemented:
<Grid.Col>
{/* */}
</Grid.Col>
How to remove the TS(2339) error in this case?
NOTE: I've seen components like these before, the compiler doesn't throw and they don't event specify the Component prop in their prop types.