Authors: @VincentLanglet
A change introduced recently means that every component can now accept children. This is simply not a valid assumption, and it breaks the principle of least astonishment. When creating a component, I expect to have to provide all props. If the component (e.g. an icon) expects no props, I want to simply provide {} as the type argument and expect any attempt to pass children (or any other props) to the component to result in an error. Moreover, children can be of a narrower type (e.g. our Button component, as per design system, only expects a string, trying to pass anything else should result in an error).
Please consider removing PropsWithChildren from FunctionComponent. Additionally, we could have a FunctionComponentWithChildren that satisfies the current use case.
@types/reactpackage and had problems.Authors: @VincentLanglet
A change introduced recently means that every component can now accept children. This is simply not a valid assumption, and it breaks the principle of least astonishment. When creating a component, I expect to have to provide all props. If the component (e.g. an icon) expects no props, I want to simply provide
{}as the type argument and expect any attempt to pass children (or any other props) to the component to result in an error. Moreover, children can be of a narrower type (e.g. our Button component, as per design system, only expects a string, trying to pass anything else should result in an error).Please consider removing
PropsWithChildrenfromFunctionComponent. Additionally, we could have aFunctionComponentWithChildrenthat satisfies the current use case.