-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: More dataviews types #61193
Conversation
Size Change: +279 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
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. |
@@ -69,24 +56,3 @@ export const SORTING_DIRECTIONS = { | |||
export const LAYOUT_TABLE = 'table'; | |||
export const LAYOUT_GRID = 'grid'; | |||
export const LAYOUT_LIST = 'list'; | |||
|
|||
export const VIEW_LAYOUTS = [ |
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.
I moved this out of this file because it would have required typing all the components and I needed the constants file to be typed.
const field = _fields.find( | ||
( _field ) => _field.id === filter.field | ||
); | ||
if ( field ) { |
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 a small thing but typescript makes you consider edge cases that you can easily miss like here.
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.
I'm not familiar with this package and haven't done any significant testing, I'm reviewing and sharing thoughts focusing on the TypeScript details.
/** | ||
* The layout of the view. | ||
*/ | ||
type: string; |
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.
It looks like this could also be a union of constants:
type: string; | |
type: 'table' | 'grid' | 'list'; |
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.
I think this list is going to be dynamic (registering layouts) ultimately.
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 one adds:
Testing instructions
There's no functional change, it's essentially a code quality + documentation change.