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 XYZPropsWeControl and cleanup internal TypeScript types #2329

Merged
merged 21 commits into from
Mar 2, 2023

Commits on Mar 2, 2023

  1. cleanup XYZPropsWeControl

    The idea behind the `PropsWeControl` is that we can omit all the fields
    that we are controlling entirely. In this case, passing a prop like
    `role`, but if we already set the role ourselves then the prop won't do
    anything at all. This is why we want to alert the end user that it is an
    "error".
    
    It can also happen that we "control" the value by default, but keep
    incoming props into account. For example we generate a unique ID for
    most components, but you can provide your own to override it. In this
    case we _don't_ want to include the ID in the `XYZPropsWeControl`.
    
    Additionally, we introduced some functionality months ago where we call
    event callbacks (`onClick`, ...) from the incoming props before our own
    callbacks. This means that by definition all `onXYZ` callbacks can be
    provided.
    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    6f49e2c View commit details
    Browse the repository at this point in the history
  2. improve defining types

    Whenever we explicitly provide custom types for certain props, then we
    make sure to omit those keys first from the original props (of let's say
    an `input`). This is important so that TypeScript doesn't try to "merge"
    those types together.
    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    9f8c685 View commit details
    Browse the repository at this point in the history
  3. cleanup: move useEffect

    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    46efcfc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    797d5f1 View commit details
    Browse the repository at this point in the history
  5. ensure tests are not using any because of onChange={console.log}

    The `console.log` is typed as `(...args: any[]) => void` which means
    that it will incorrectly mark its incoming data as `any` as well.
    Converting it to `x => console.log(x)` makes TypeScript happy. Or in
    this case, angry since it found a bug.
    
    This is required because it _can_ be that your value (e.g.: the value of
    a Combobox) is an object (e.g.: a `User`), but it is also nullable.
    
    Therefore we can provide the value `null`. This would mean that
    eventually this resolves to `keyof null` which is `never`, but we just
    want a string in this case.
    
    ```diff
    -export type ByComparator<T> = (keyof T & string) | ((a: T, b: T) => boolean)
    +export type ByComparator<T> =
    +  | (T extends null ? string : keyof T & string)
    +  | ((a: T, b: T) => boolean)
    ```
    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    e2511a9 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3043aed View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    bbb0df5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9c74185 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8007ced View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    70f40c0 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c071a52 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    459c2f9 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    17a77ef View commit details
    Browse the repository at this point in the history
  14. cleanup unused code

    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    0677ab3 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    4e81456 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7991ec5 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    4a027e3 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    8508faf View commit details
    Browse the repository at this point in the history
  19. improve internal types of the Transition component (Vue)

    + add `attrs.class` as well
    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    2d00943 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    7355460 View commit details
    Browse the repository at this point in the history
  21. update changelog

    RobinMalfait committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    478c18e View commit details
    Browse the repository at this point in the history