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

fix: improve dataview types #61586

Merged
merged 4 commits into from
May 15, 2024
Merged

Commits on May 15, 2024

  1. fix: improve dataview types

    This commit improves the types in the dataviews package.
    
    This is helpful by typing the `item` or `items` provided as arguments
    to the functions of the fields and actions of the `DataViews`.
    
    This commit does not implement requiring these types in the `DataView`
    component, but helps to improve the types of the functions that are
    used in the `DataView` package. It also allows exporting the types
    to be used in consumers of the package.
    
    - Add generic item type to all dataview types that operate
    on `item` or lists of `items`.
    
    - Update the usage in the dataviews package to incorporate
    the use of the generic item type.
    
    - Add an `Action` type for the dataview actions.
    johnhooks authored and youknowriad committed May 15, 2024
    Configuration menu
    Copy the full SHA
    9f6dc45 View commit details
    Browse the repository at this point in the history
  2. feat: add generic types to DataView action type

    This commit expands the original PR to include generic
    types for `@wordpress/dataview` actions.
    
    This commit also does the following:
    
    - Applies several CR suggestions from @youknowriad and
    @sirreal.
    - Adds generic types to to all .ts/.tsx files in the dataviews.
    - Renames `Item` to `AnyItem` to match the pattern of `@wordpress/data`.
    - Name all generic types to `Item` which helps to make the code more readable,
      despite the fact TypeScript generics are in general cryptic.
    johnhooks authored and youknowriad committed May 15, 2024
    Configuration menu
    Copy the full SHA
    1b6bce2 View commit details
    Browse the repository at this point in the history
  3. add generics to bulk-actions.tsx

    johnhooks authored and youknowriad committed May 15, 2024
    Configuration menu
    Copy the full SHA
    f39de2a View commit details
    Browse the repository at this point in the history
  4. replace getValue return type of any

    johnhooks authored and youknowriad committed May 15, 2024
    Configuration menu
    Copy the full SHA
    2176055 View commit details
    Browse the repository at this point in the history