Skip to content
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

Decide best practices for typing React props #1723

Open
victorlin opened this issue Nov 14, 2023 · 1 comment
Open

Decide best practices for typing React props #1723

victorlin opened this issue Nov 14, 2023 · 1 comment

Comments

@victorlin
Copy link
Member

With the adoption of TypeScript, there should be a standard way of typing props. This was explored in #1704 and we came up with these options:

  1. Define each set of props independently without importing other prop types. This is the simplest approach but results in much code duplication when it comes to prop drilling, especially when each prop has a descriptive docstring.
  2. Export individual prop types that are used by a parent. This is what was done in Redesign panel sections in sidebar #1704.
  3. Export all props under one type if any are used by a parent. This was considered and evaluated in Redesign panel sections in sidebar #1704 (comment).
@victorlin
Copy link
Member Author

I think (2) is just fine for now, but we might want to keep the door open to other options with increased TypeScript adoption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant