-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Commits on Mar 2, 2023
-
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.
Configuration menu - View commit details
-
Copy full SHA for 6f49e2c - Browse repository at this point
Copy the full SHA 6f49e2cView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 9f8c685 - Browse repository at this point
Copy the full SHA 9f8c685View commit details -
Configuration menu - View commit details
-
Copy full SHA for 46efcfc - Browse repository at this point
Copy the full SHA 46efcfcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 797d5f1 - Browse repository at this point
Copy the full SHA 797d5f1View commit details -
ensure tests are not using
any
because ofonChange={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) ```
Configuration menu - View commit details
-
Copy full SHA for e2511a9 - Browse repository at this point
Copy the full SHA e2511a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3043aed - Browse repository at this point
Copy the full SHA 3043aedView commit details -
Configuration menu - View commit details
-
Copy full SHA for bbb0df5 - Browse repository at this point
Copy the full SHA bbb0df5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c74185 - Browse repository at this point
Copy the full SHA 9c74185View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8007ced - Browse repository at this point
Copy the full SHA 8007cedView commit details -
Configuration menu - View commit details
-
Copy full SHA for 70f40c0 - Browse repository at this point
Copy the full SHA 70f40c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for c071a52 - Browse repository at this point
Copy the full SHA c071a52View commit details -
Configuration menu - View commit details
-
Copy full SHA for 459c2f9 - Browse repository at this point
Copy the full SHA 459c2f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 17a77ef - Browse repository at this point
Copy the full SHA 17a77efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0677ab3 - Browse repository at this point
Copy the full SHA 0677ab3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e81456 - Browse repository at this point
Copy the full SHA 4e81456View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7991ec5 - Browse repository at this point
Copy the full SHA 7991ec5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a027e3 - Browse repository at this point
Copy the full SHA 4a027e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8508faf - Browse repository at this point
Copy the full SHA 8508fafView commit details -
improve internal types of the
Transition
component (Vue)+ add `attrs.class` as well
Configuration menu - View commit details
-
Copy full SHA for 2d00943 - Browse repository at this point
Copy the full SHA 2d00943View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7355460 - Browse repository at this point
Copy the full SHA 7355460View commit details -
Configuration menu - View commit details
-
Copy full SHA for 478c18e - Browse repository at this point
Copy the full SHA 478c18eView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.