-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Closed
Description
If you know how to fix the issue, make a pull request instead.
- I tried using the
@types/xxxxpackage 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).
- Mention the authors (see
Definitions by:inindex.d.ts) so they can respond.
I prefer to be explicit with my types, and I noticed something, that all components, at least functional ones that use React.FC or React.FunctionComponent have a generic that unionizes with PropsWithChildren that automatically adds { children?: ReactNode } and I feel that is incorrect or misleading.
Given a component that does not accept or use children that prop should not be present, right? It's not passed by React at all. Example shown in screenshot below. So why is it given as a potential prop default on all component types?
I feel this defeats the purpose of types. TypeScript should technically give an error if you did <Foo>hi</foo> and <Foo /> never used the children prop.
Metadata
Metadata
Assignees
Labels
No labels
