-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Description
- I tried using the
@types/reactpackage and had problems. - I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
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.