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

[core] Remove any from React.ReactElement types #42380

Closed
Tracked by #42032
DiegoAndai opened this issue May 24, 2024 · 8 comments
Closed
Tracked by #42032

[core] Remove any from React.ReactElement types #42380

DiegoAndai opened this issue May 24, 2024 · 8 comments
Assignees
Labels
core Infrastructure work going on behind the scenes ready to take Help wanted. Guidance available. There is a high chance the change will be accepted typescript

Comments

@DiegoAndai
Copy link
Member

DiegoAndai commented May 24, 2024

Context

In the upcoming React 19 @types/ packages, the props of ReactElement now default to unknown instead of any.

We have many occurrences that rely on ReactElement props being any (the previous default). To migrate to React 19, the any type was specified explicitly in #42346, so we can keep the previous default behavior.

This issue

We should gradually remove any and rely on the new default, unknown. This is what this issue is tracking.

Search keywords: react 19 types any react element

@DiegoAndai DiegoAndai added typescript core Infrastructure work going on behind the scenes labels May 24, 2024
@DiegoAndai DiegoAndai self-assigned this May 24, 2024
@DiegoAndai DiegoAndai added the ready to take Help wanted. Guidance available. There is a high chance the change will be accepted label May 24, 2024
@fedirjh
Copy link
Contributor

fedirjh commented May 25, 2024

@DiegoAndai I would like to pick this up.

@DiegoAndai
Copy link
Member Author

Hey @fedirjh! Sure 😊, go ahead. There are a lot of occurrences, so please divide the work into smaller PRs if possible.

Let me know if you need any help. Thanks in advance.

@DiegoAndai
Copy link
Member Author

DiegoAndai commented Nov 28, 2024

@sai6855
Copy link
Contributor

sai6855 commented Dec 3, 2024

@sai6855 I think the only ones left to migrate are the ones missing in https://github.com/sai6855/material-ui/blob/master/packages-internal/test-utils/src/describeConformance.tsx

these got removed in #44318 know ?

@DiegoAndai
Copy link
Member Author

@sai6855
Copy link
Contributor

sai6855 commented Dec 3, 2024

There are some missing: https://github.com/search?q=repo%3Asai6855%2Fmaterial-ui+React.ReactElement%3Cany%3E++path%3Apackages-internal&type=code

Oops i missed addressing these, opened PR to remove those #44639

@DiegoAndai
Copy link
Member Author

Thanks @sai6855! Nice work.

With this, we've removed all any from React.ReactElement where possible. There are still a couple of edge cases where it was required, but I consider this as completed.

Copy link

github-actions bot commented Dec 3, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes ready to take Help wanted. Guidance available. There is a high chance the change will be accepted typescript
Projects
None yet
Development

No branches or pull requests

4 participants