Skip to content

chore: remove most usage of PropsWithChildren #11859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Jan 26, 2024

there are a lot of places where we use PropsWithChildren, and it either...

  • actually makes the type incorrect (because the component does not actually accept/use the children prop)
  • splits the definition of the props type into two places ("here are most of the props this component takes, and oh btw it also takes children), making the code slightly harder to decipher

I propose that...

  • PropsWithChildren should only be used ungenerically, when children?: ReactNode is the the only prop accepted by the component.
  • If a component accepts any props other than children?: ReactNode, it must declare it's own props type, and not use PropsWithChildren

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%

@aslilac aslilac merged commit 8f46bee into main Jan 26, 2024
@aslilac aslilac deleted the remove-unnecessary-props-with-children branch January 26, 2024 19:04
@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants