-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DataViews: Type the ItemActions component #61400
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
I see some CI failures on this PR - I think they might be fixed by upgrading our react types (#60796). It seems like ariakit expects a different version of react types than we have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I suspect the CI failures are unrelated.
return ( | ||
<DropdownMenuGroup> | ||
{ actions.map( ( action ) => { | ||
if ( !! action.RenderModal ) { | ||
if ( 'RenderModal' in action ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more readable, I like it. Is this related to any TypeScript thing I should be aware of or just an unrelated change that was nice to have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, basically when you do this, typescript is able to figure out the type of action that has the "RenderModal" defined. If you keep the old check, typescript will complain that RenderModal may or may not be defined.
bcba371
to
d135703
Compare
I'm squash-merging #61486 here to confirm that fixes all the issues we're seeing here. It's not intended to be landed as part of this PR. EDIT: I should've set this to draft before it pinged all the codeowners. Sorry for the noise, folks! |
8a04cad
to
ffaa966
Compare
3e98949
to
7e30226
Compare
* This should be IconType from the components package | ||
* but that import is breaking typescript build for the moment. | ||
*/ | ||
icon?: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it turns out that it was the import of IconType
from the components package that was breaking the build in this PR. Using any temporarily should fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 Just when #61486 is almost ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some detail:
I think this works around the issue that #61486 addresses. The problem was a symptom of the skipLibCheck
not being present in this package's tsconfig. Because of problems in library types, anything that depended on the components package was effectively "infected" by invalid library types and would then require skipLibCheck
.
Size Change: +19 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
The failing linting test here is already failing on trunk (order CSS property). It should be addressed separately. |
Related #55083
Follow-up to #61185
What?
The DataViews package is a types heavy package. There's a lot of structures that need to be documented properly. So this continues the effort to add explicit types to the package. This PR focuses on typing the ItemsActions component which forces us to define our Action types properly.
Testing instructions
There's no functional change, it's essentially a code quality + documentation change.